summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-04-20 08:21:41 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-04-20 08:21:41 +0000
commitcc70bcf9038f0eac57ec1f0becd7b500fbad8686 (patch)
tree33b2a796b5669595baa3dc8abedbc30bf75204f4 /io.c
parent2bcb001084e404a16de41f4270f0785ac2258f85 (diff)
to open CVS
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/io.c b/io.c
index bfe07df80c..4678e2abcc 100644
--- a/io.c
+++ b/io.c
@@ -1299,6 +1299,7 @@ f_open(argc, argv)
}
port = io_open(RSTRING(pname)->ptr, mode);
+ if (NIL_P(port)) return Qnil;
if (iterator_p()) {
return rb_ensure(rb_yield, port, io_close, port);
}
@@ -1313,10 +1314,6 @@ io_get_io(io)
return rb_convert_type(io, T_FILE, "IO", "to_io");
}
-#ifndef NT
-extern char *strdup();
-#endif
-
static char*
io_mode_string(fptr)
OpenFile *fptr;
@@ -1658,7 +1655,7 @@ io_defset(val, id)
val = io_open(RSTRING(val)->ptr, "w");
}
if (!rb_respond_to(val, id_write)) {
- TypeError("$< must have write method, %s given",
+ TypeError("$> must have write method, %s given",
rb_class2name(CLASS_OF(val)));
}
rb_defout = val;
@@ -1969,6 +1966,8 @@ f_backquote(obj, str)
Check_SafeStr(str);
port = pipe_open(RSTRING(str)->ptr, "r");
+ if (NIL_P(port)) return Qnil;
+
result = read_all(port);
io_close(port);
@@ -2393,6 +2392,7 @@ io_s_foreach(argc, argv, io)
arg.argc = argc - 1;
arg.io = io_open(RSTRING(fname)->ptr, "r");
+ if (NIL_P(arg.io)) return Qnil;
return rb_ensure(io_foreach_line, (VALUE)&arg, io_close, arg.io);
}
@@ -2424,6 +2424,7 @@ io_s_readlines(argc, argv, io)
arg.argc = argc - 1;
arg.io = io_open(RSTRING(fname)->ptr, "r");
+ if (NIL_P(arg.io)) return Qnil;
return rb_ensure(io_readline_line, (VALUE)&arg, io_close, arg.io);
}