summaryrefslogtreecommitdiff
path: root/ext/curses
diff options
context:
space:
mode:
Diffstat (limited to 'ext/curses')
-rw-r--r--ext/curses/curses.c24
-rw-r--r--ext/curses/extconf.rb15
2 files changed, 29 insertions, 10 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);
}
diff --git a/ext/curses/extconf.rb b/ext/curses/extconf.rb
index 442a9424a2..e1bf24c435 100644
--- a/ext/curses/extconf.rb
+++ b/ext/curses/extconf.rb
@@ -1,22 +1,21 @@
require 'mkmf'
-$CFLAGS="-I/usr/include/ncurses -I/usr/local/include/ncurses"
-$LDFLAGS="-L/usr/local/lib"
-make=FALSE
+make=false
have_library("mytinfo", "tgetent") if /bow/ =~ PLATFORM
if have_header("ncurses.h") and have_library("ncurses", "initscr")
- make=TRUE
+ make=true
elsif have_header("ncurses/curses.h") and have_library("ncurses", "initscr")
- make=TRUE
+ make=true
+elsif have_header("curses_colr/curses.h") and have_library("cur_colr", "initscr")
+ make=true
else
- $CFLAGS=nil
have_library("termcap", "tgetent")
if have_library("curses", "initscr")
- make=TRUE
+ make=true
end
end
-if make then
+if make
for f in %w(isendwin ungetch beep doupdate flash deleteln wdeleteln)
have_func(f)
end