aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--ext/io/console/console.c6
-rw-r--r--ext/io/console/extconf.rb2
3 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3c75674fca..6cde45950b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,6 @@
-Sat Feb 16 12:46:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Feb 16 12:47:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/console.c (console_dev): compatibility with ruby 1.8.
* ext/io/console/console.c (rawmode_opt, console_dev): compatibility
with ruby 1.9. [ruby-core:52220] [Bug #7847]
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index 6c7a31b5e0..2e8f0e387e 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -7,6 +7,8 @@
#include "ruby/io.h"
#else
#include "rubyio.h"
+/* assumes rb_io_t doesn't have pathv */
+#include "util.h" /* for ruby_strdup() */
#endif
#ifndef HAVE_RB_IO_T
@@ -742,7 +744,11 @@ console_dev(VALUE klass)
args[0] = INT2NUM(fd);
con = rb_class_new_instance(2, args, klass);
GetOpenFile(con, fptr);
+#ifdef HAVE_RUBY_IO_H
fptr->pathv = rb_obj_freeze(rb_str_new2(CONSOLE_DEVICE));
+#else
+ fptr->path = ruby_strdup(CONSOLE_DEVICE);
+#endif
#ifdef CONSOLE_DEVICE_FOR_WRITING
GetOpenFile(out, ofptr);
# ifdef HAVE_RB_IO_GET_WRITE_IO
diff --git a/ext/io/console/extconf.rb b/ext/io/console/extconf.rb
index 918f86b27f..79f5838c5e 100644
--- a/ext/io/console/extconf.rb
+++ b/ext/io/console/extconf.rb
@@ -12,6 +12,8 @@ when have_header(hdr = "sgtty.h")
else
ok = false
end
+ok &&= enable_config("io-console-force-compatible-with-1.8") ||
+ macro_defined?("HAVE_RUBY_IO_H", "ruby.h")
if ok
have_header("sys/ioctl.h")
have_func("rb_check_hash_type", "ruby.h")