diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-08-30 17:25:24 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-08-30 17:25:24 -0300 |
commit | b04294d3d87d399e69f5b6329e93f565bd4cf40a (patch) | |
tree | f0b5d7188e9171b4bdfc260d2629054cb7a73f8e | |
parent | 22c27048428850c56b3be6f20245a2d19f14c68c (diff) | |
download | lua-b04294d3d87d399e69f5b6329e93f565bd4cf40a.tar.gz lua-b04294d3d87d399e69f5b6329e93f565bd4cf40a.tar.bz2 lua-b04294d3d87d399e69f5b6329e93f565bd4cf40a.zip |
details.
-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 */ |