summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-03-28 09:17:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-03-28 09:17:54 +0000
commitcc38f5f090797b332633f8ead2dc1d34601fb03e (patch)
treec85f1303d657551e9717c9f2acd0bfaa9cccc6d8 /io.c
parentff95039936708914c3f973ce26f1991382b2c358 (diff)
downloadruby-cc38f5f090797b332633f8ead2dc1d34601fb03e.tar.gz
* ext/socket/socket.c (sock_addrinfo): should specify socktype
from outside. * io.c (argf_binmode): should call next_argv() to initialize ARGF. * io.c (argf_filename): ditto. * io.c (argf_file): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/io.c b/io.c
index 6356c89d05..c346e99d50 100644
--- a/io.c
+++ b/io.c
@@ -255,6 +255,7 @@ io_fflush(f, path)
n = fflush(f);
TRAP_END;
if (n == EOF) rb_sys_fail(path);
+ fptr->mode &= ~FMODE_WBUF;
}
/* writing functions */
@@ -299,7 +300,6 @@ io_write(io, str)
#endif
if (fptr->mode & FMODE_SYNC) {
io_fflush(f, fptr->path);
- fptr->mode &= ~FMODE_WBUF;
}
else {
fptr->mode |= FMODE_WBUF;
@@ -2668,19 +2668,6 @@ argf_forward()
ruby_frame->argc, ruby_frame->argv);
}
-static VALUE
-argf_binmode()
-{
- if (TYPE(current_file) != T_FILE) {
- argf_forward();
- }
- else {
- rb_io_binmode(current_file);
- }
- binmode = 1;
- return argf;
-}
-
static int
next_argv()
{
@@ -3608,16 +3595,32 @@ argf_each_byte()
static VALUE
argf_filename()
{
+ next_argv();
return filename;
}
static VALUE
argf_file()
{
+ next_argv();
return current_file;
}
static VALUE
+argf_binmode()
+{
+ binmode = 1;
+ next_argv();
+ if (TYPE(current_file) != T_FILE) {
+ argf_forward();
+ }
+ else {
+ rb_io_binmode(current_file);
+ }
+ return argf;
+}
+
+static VALUE
argf_skip()
{
if (next_p != -1) {