aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-28 20:29:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-28 20:29:32 +0000
commit29621688c75a3124e538c8fae590f2c321d1c5e8 (patch)
treed10c7b98a20b4a484f84c98e66591c0f5dd392aa /io.c
parentc351afc37276bb3d82eabe142a20be10127fed27 (diff)
downloadruby-29621688c75a3124e538c8fae590f2c321d1c5e8.tar.gz
* io.c (rb_io_fdopen): create IO object from fd.
* parse.y (yycompile): use encoding of the source as default. * ruby.c (proc_options, load_file): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/io.c b/io.c
index 4fc5bcc59a..0234c3ca64 100644
--- a/io.c
+++ b/io.c
@@ -4186,6 +4186,15 @@ prep_io(int fd, int mode, VALUE klass, const char *path)
return io;
}
+VALUE
+rb_io_fdopen(int fd, int mode, const char *path)
+{
+ VALUE klass = rb_cIO;
+
+ if (path && strcmp(path, "-")) klass = rb_cFile;
+ return prep_io(fd, rb_io_modenum_flags(mode), klass, path);
+}
+
static VALUE
prep_stdio(FILE *f, int mode, VALUE klass, const char *path)
{