diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-11-10 16:32:59 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-11-10 16:32:59 -0200 |
commit | 0c3e0fd95d4375da18917563b14252e1700bd3bb (patch) | |
tree | 2b84e2c7ba077a65fa594756d1b33edbc4fef8d2 | |
parent | 3bb6443131da2285b2311f258dfe37a3dcd38a5f (diff) | |
download | lua-0c3e0fd95d4375da18917563b14252e1700bd3bb.tar.gz lua-0c3e0fd95d4375da18917563b14252e1700bd3bb.tar.bz2 lua-0c3e0fd95d4375da18917563b14252e1700bd3bb.zip |
"read" must return 'nil' on EOF.
-rw-r--r-- | iolib.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** Input/output library to LUA | 3 | ** Input/output library to LUA |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_iolib="$Id: iolib.c,v 1.27 1995/11/03 15:43:50 roberto Exp roberto $"; | 6 | char *rcs_iolib="$Id: iolib.c,v 1.28 1995/11/10 17:55:48 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | #include <ctype.h> | 9 | #include <ctype.h> |
@@ -247,6 +247,11 @@ static void read_free (void) | |||
247 | int c; | 247 | int c; |
248 | while (isspace(c=fgetc(in))) | 248 | while (isspace(c=fgetc(in))) |
249 | ; | 249 | ; |
250 | if (c == EOF) | ||
251 | { | ||
252 | lua_pushnil(); | ||
253 | return; | ||
254 | } | ||
250 | if (c == '\"' || c == '\'') | 255 | if (c == '\"' || c == '\'') |
251 | { /* string */ | 256 | { /* string */ |
252 | c = read_until_char(c); | 257 | c = read_until_char(c); |