aboutsummaryrefslogtreecommitdiff
path: root/liolib.c
diff options
context:
space:
mode:
Diffstat (limited to 'liolib.c')
-rw-r--r--liolib.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/liolib.c b/liolib.c
index 4befcfa6..46c4e87c 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 1.8 1997/11/28 12:40:37 roberto Exp roberto $ 2** $Id: liolib.c,v 1.9 1997/12/09 13:50:08 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*/
@@ -190,7 +190,7 @@ static void io_read (void)
190 char *p = luaL_opt_string(arg, "[^\n]*{\n}"); 190 char *p = luaL_opt_string(arg, "[^\n]*{\n}");
191 int inskip = 0; /* to control {skips} */ 191 int inskip = 0; /* to control {skips} */
192 int c = NEED_OTHER; 192 int c = NEED_OTHER;
193 luaI_emptybuff(); 193 luaL_resetbuffer();
194 while (*p) { 194 while (*p) {
195 if (*p == '{') { 195 if (*p == '{') {
196 inskip++; 196 inskip++;
@@ -208,7 +208,7 @@ static void io_read (void)
208 if (c == NEED_OTHER) c = getc(f); 208 if (c == NEED_OTHER) c = getc(f);
209 m = luaI_singlematch((c == EOF) ? 0 : (char)c, p, &ep); 209 m = luaI_singlematch((c == EOF) ? 0 : (char)c, p, &ep);
210 if (m) { 210 if (m) {
211 if (inskip == 0) luaI_addchar(c); 211 if (inskip == 0) luaL_addchar(c);
212 c = NEED_OTHER; 212 c = NEED_OTHER;
213 } 213 }
214 switch (*ep) { 214 switch (*ep) {
@@ -227,7 +227,8 @@ static void io_read (void)
227 } break_while: 227 } break_while:
228 if (c >= 0) /* not EOF nor NEED_OTHER? */ 228 if (c >= 0) /* not EOF nor NEED_OTHER? */
229 ungetc(c, f); 229 ungetc(c, f);
230 buff = luaI_addchar(0); 230 luaL_addchar(0);
231 buff = luaL_buffer();
231 if (*buff != 0 || *p == 0) /* read something or did not fail? */ 232 if (*buff != 0 || *p == 0) /* read something or did not fail? */
232 lua_pushstring(buff); 233 lua_pushstring(buff);
233} 234}