io/console: compatibility with 1.9
* ext/io/console/console.c (rawmode_opt, console_dev): compatibility with ruby 1.9. [ruby-core:52220] [Bug #7847] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
62711da253
commit
44c24d4416
@ -1,3 +1,8 @@
|
|||||||
|
Sat Feb 16 12:46:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/io/console/console.c (rawmode_opt, console_dev): compatibility
|
||||||
|
with ruby 1.9. [ruby-core:52220] [Bug #7847]
|
||||||
|
|
||||||
Sat Feb 16 12:45:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sat Feb 16 12:45:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* configure.in: unexpand arch sitearch and exec_prefix values, so
|
* configure.in: unexpand arch sitearch and exec_prefix values, so
|
||||||
|
@ -23,6 +23,10 @@ typedef OpenFile rb_io_t;
|
|||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef RB_TYPE_P
|
||||||
|
#define RB_TYPE_P(obj, type) (TYPE(obj) == type)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined HAVE_TERMIOS_H
|
#if defined HAVE_TERMIOS_H
|
||||||
# include <termios.h>
|
# include <termios.h>
|
||||||
typedef struct termios conmode;
|
typedef struct termios conmode;
|
||||||
@ -101,7 +105,23 @@ rawmode_opt(int argc, VALUE *argv, rawmode_arg_t *opts)
|
|||||||
{
|
{
|
||||||
rawmode_arg_t *optp = NULL;
|
rawmode_arg_t *optp = NULL;
|
||||||
VALUE vopts;
|
VALUE vopts;
|
||||||
|
#ifdef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH
|
||||||
rb_scan_args(argc, argv, "0:", &vopts);
|
rb_scan_args(argc, argv, "0:", &vopts);
|
||||||
|
#else
|
||||||
|
vopts = Qnil;
|
||||||
|
if (argc > 0) {
|
||||||
|
vopts = argv[--argc];
|
||||||
|
if (!NIL_P(vopts)) {
|
||||||
|
# ifdef HAVE_RB_CHECK_HASH_TYPE
|
||||||
|
vopts = rb_check_hash_type(vopts);
|
||||||
|
if (NIL_P(vopts)) ++argc;
|
||||||
|
# else
|
||||||
|
Check_Type(vopts, T_HASH);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rb_scan_args(argc, argv, "0");
|
||||||
|
#endif
|
||||||
if (!NIL_P(vopts)) {
|
if (!NIL_P(vopts)) {
|
||||||
VALUE vmin = rb_hash_aref(vopts, ID2SYM(rb_intern("min")));
|
VALUE vmin = rb_hash_aref(vopts, ID2SYM(rb_intern("min")));
|
||||||
VALUE vtime = rb_hash_aref(vopts, ID2SYM(rb_intern("time")));
|
VALUE vtime = rb_hash_aref(vopts, ID2SYM(rb_intern("time")));
|
||||||
@ -644,6 +664,23 @@ console_ioflush(VALUE io)
|
|||||||
return io;
|
return io;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_RB_CLOEXEC_OPEN
|
||||||
|
static int
|
||||||
|
rb_cloexec_open(const char *pathname, int flags, mode_t mode)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
#ifdef O_CLOEXEC
|
||||||
|
/* O_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */
|
||||||
|
flags |= O_CLOEXEC;
|
||||||
|
#elif defined O_NOINHERIT
|
||||||
|
flags |= O_NOINHERIT;
|
||||||
|
#endif
|
||||||
|
return open(pathname, flags, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define rb_update_max_fd(fd) (void)(fd)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* IO.console -> #<File:/dev/tty>
|
* IO.console -> #<File:/dev/tty>
|
||||||
|
@ -12,9 +12,10 @@ when have_header(hdr = "sgtty.h")
|
|||||||
else
|
else
|
||||||
ok = false
|
ok = false
|
||||||
end
|
end
|
||||||
have_header("sys/ioctl.h")
|
|
||||||
have_func("rb_io_get_write_io", "ruby/io.h")
|
|
||||||
have_func("dup3", "unistd.h")
|
|
||||||
if ok
|
if ok
|
||||||
|
have_header("sys/ioctl.h")
|
||||||
|
have_func("rb_check_hash_type", "ruby.h")
|
||||||
|
have_func("rb_io_get_write_io", "ruby/io.h")
|
||||||
|
have_func("rb_cloexec_open", "ruby/io.h")
|
||||||
create_makefile("io/console")
|
create_makefile("io/console")
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user