aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-07-07 18:05:51 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-07-07 18:05:51 -0300
commit66be42549e5eb5f25de6b8cbfee8a064b914cbb0 (patch)
tree86b005c4cfdf64999b4643cdee32a4bb94c5340e
parent067db30d715c999c3a5f6cb2da3cc7e863732603 (diff)
downloadlua-66be42549e5eb5f25de6b8cbfee8a064b914cbb0.tar.gz
lua-66be42549e5eb5f25de6b8cbfee8a064b914cbb0.tar.bz2
lua-66be42549e5eb5f25de6b8cbfee8a064b914cbb0.zip
BUG: files starting with '#' get wrong line numbers
-rw-r--r--inout.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/inout.c b/inout.c
index 0b36c70e..f4694fe1 100644
--- a/inout.c
+++ b/inout.c
@@ -5,7 +5,7 @@
5** Also provides some predefined lua functions. 5** Also provides some predefined lua functions.
6*/ 6*/
7 7
8char *rcs_inout="$Id: inout.c,v 2.68 1997/06/26 20:47:43 roberto Exp roberto $"; 8char *rcs_inout="$Id: inout.c,v 2.69 1997/06/27 22:38:49 roberto Exp roberto $";
9 9
10#include <stdio.h> 10#include <stdio.h>
11#include <string.h> 11#include <string.h>
@@ -73,7 +73,8 @@ int lua_dofile (char *filename)
73 } 73 }
74 else { 74 else {
75 if (c == '#') 75 if (c == '#')
76 while ((c=fgetc(f)) != '\n') /* skip first line */; 76 while ((c=fgetc(f)) != '\n' && c != 0) /* skip first line */;
77 ungetc(c, f);
77 status = lua_doFILE(f, 0); 78 status = lua_doFILE(f, 0);
78 } 79 }
79 if (f != stdin) 80 if (f != stdin)