aboutsummaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-16 03:47:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-16 03:47:21 +0000
commit6ba2001d72c05c59bb973d7934c324263552b5c9 (patch)
tree634ed2325de75d0cb84cb16751ba7857a16a1bb1 /ext
parent44c24d4416a9c3f36010dcf0593e5dce21183d19 (diff)
downloadruby-6ba2001d72c05c59bb973d7934c324263552b5c9.tar.gz
io/console: compatibility with 1.8
* ext/io/console/console.c (console_dev): compatibility with ruby 1.8. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/io/console/console.c6
-rw-r--r--ext/io/console/extconf.rb2
2 files changed, 8 insertions, 0 deletions
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")