diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-08-15 06:22:49 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-08-15 06:22:49 +0000 |
commit | c345257ff6c1e913125739545a40cc1b60b62611 (patch) | |
tree | 410afef9741dff97642c267ece942d7cfeeab0f6 /io.c | |
parent | 37282fa5b083375cab6780824a8941c459b59ebe (diff) | |
download | ruby-c345257ff6c1e913125739545a40cc1b60b62611.tar.gz |
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -89,7 +89,7 @@ struct timeval rb_time_interval _((VALUE)); static VALUE filename, current_file; static int gets_lineno; -static int init_p = 0, next_p = 0; +static int init_p = 0, next_p = 0, first_p = 1; static VALUE lineno; #ifdef _STDIO_USES_IOSTREAM /* GNU libc */ @@ -2362,6 +2362,7 @@ next_argv() current_file = rb_stdin; } init_p = 1; + first_p = 0; gets_lineno = 0; } @@ -3168,8 +3169,12 @@ argf_readchar() static VALUE argf_eof() { - if (init_p == 0 && !next_argv()) + int first = first_p; + + if (!next_argv()) return Qtrue; + if (!first && next_p == -1) { return Qtrue; + } if (TYPE(current_file) != T_FILE) { return argf_forward(); } |