diff options
| -rw-r--r-- | liolib.c | 6 |
1 files changed, 4 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: liolib.c,v 1.22 1998/08/21 17:43:44 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 1.23 1998/08/24 20:14:56 roberto Exp roberto $ |
| 3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -195,6 +195,8 @@ static void read_until (FILE *f, int lim) { | |||
| 195 | } | 195 | } |
| 196 | if (l > 0 || c == lim) /* read anything? */ | 196 | if (l > 0 || c == lim) /* read anything? */ |
| 197 | lua_pushlstring(luaL_buffer(), l); | 197 | lua_pushlstring(luaL_buffer(), l); |
| 198 | else | ||
| 199 | lua_pushnil(); | ||
| 198 | } | 200 | } |
| 199 | 201 | ||
| 200 | static void io_read (void) { | 202 | static void io_read (void) { |
| @@ -204,7 +206,7 @@ static void io_read (void) { | |||
| 204 | luaL_resetbuffer(); | 206 | luaL_resetbuffer(); |
| 205 | if (p == NULL) /* default: read a line */ | 207 | if (p == NULL) /* default: read a line */ |
| 206 | read_until(f, '\n'); | 208 | read_until(f, '\n'); |
| 207 | else if (p[0] == '.' && p[1] == '*' && p[2] == 0) /* p = ".*" */ | 209 | else if (strcmp(p, ".*") == 0) |
| 208 | read_until(f, EOF); | 210 | read_until(f, EOF); |
| 209 | else { | 211 | else { |
| 210 | int l = 0; /* number of chars read in buffer */ | 212 | int l = 0; /* number of chars read in buffer */ |
