summaryrefslogtreecommitdiff
path: root/ext/curses/curses.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/curses/curses.c')
-rw-r--r--ext/curses/curses.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/ext/curses/curses.c b/ext/curses/curses.c
index f3d1bc0970..202a0f9244 100644
--- a/ext/curses/curses.c
+++ b/ext/curses/curses.c
@@ -10,6 +10,10 @@
#else
# ifdef HAVE_NCURSES_CURSES_H
# include <ncurses/curses.h>
+#else
+# ifdef HAVE_CURSES_COLR_CURSES_H
+# include <varargs.h>
+# include <curses_colr/curses.h>
# else
# include <curses.h>
# if (defined(__bsdi__) || defined(__NetBSD__)) && !defined(_maxx)
@@ -26,8 +30,11 @@
# endif
# endif
#endif
+#endif
+#include "stdio.h"
#include "ruby.h"
+#include "rubyio.h"
static VALUE mCurses;
static VALUE cWindow;
@@ -350,6 +357,7 @@ static VALUE
curses_getch(obj)
VALUE obj;
{
+ rb_read_check(stdin);
return CHR2FIX(getch());
}
@@ -359,6 +367,8 @@ curses_getstr(obj)
VALUE obj;
{
char rtn[1024]; /* This should be big enough.. I hope */
+
+ rb_read_check(stdin);
getstr(rtn);
return rb_tainted_str_new2(rtn);
}
@@ -408,11 +418,13 @@ window_s_new(class, lines, cols, top, left)
{
VALUE w;
WINDOW *window;
+ VALUE args[4];
window = newwin(NUM2INT(lines), NUM2INT(cols), NUM2INT(top), NUM2INT(left));
wclear(window);
w = prep_window(class, window);
- rb_obj_call_init(w);
+ args[0] = lines; args[1] = cols; args[2] = top; args[3] = left;
+ rb_obj_call_init(w, 4, args);
return w;
}
@@ -428,11 +440,17 @@ window_subwin(obj, lines, cols, top, left)
{
struct windata *winp;
WINDOW *window;
+ VALUE w;
+ VALUE args[4];
GetWINDOW(obj, winp);
window = subwin(winp->window, NUM2INT(lines), NUM2INT(cols),
NUM2INT(top), NUM2INT(left));
- return prep_window(cWindow, window);
+ w = prep_window(cWindow, window);
+ args[0] = lines; args[1] = cols; args[2] = top; args[3] = left;
+ rb_obj_call_init(w, 4, args);
+
+ return w;
}
/* def close */
@@ -717,6 +735,7 @@ window_getch(obj)
{
struct windata *winp;
+ rb_read_check(stdin);
GetWINDOW(obj, winp);
return CHR2FIX(wgetch(winp->window));
}
@@ -730,6 +749,7 @@ window_getstr(obj)
char rtn[1024]; /* This should be big enough.. I hope */
GetWINDOW(obj, winp);
+ rb_read_check(stdin);
wgetstr(winp->window, rtn);
return rb_tainted_str_new2(rtn);
}