diff options
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(); } |