summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-08-15 06:22:49 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-08-15 06:22:49 +0000
commitc345257ff6c1e913125739545a40cc1b60b62611 (patch)
tree410afef9741dff97642c267ece942d7cfeeab0f6 /io.c
parent37282fa5b083375cab6780824a8941c459b59ebe (diff)
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.c9
1 files changed, 7 insertions, 2 deletions
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();
}