From c345257ff6c1e913125739545a40cc1b60b62611 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 15 Aug 2000 06:22:49 +0000 Subject: matz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 642dd05f5d..9f03c09a96 100644 --- a/io.c +++ b/io.c @@ -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(); } -- cgit v1.2.3