aboutsummaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-11-28 12:44:48 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-11-28 12:44:48 -0200
commit3592c08a2c56b4378993825c62b47d483829b9b5 (patch)
tree606822e9f512ce1dada8db7755ded03293eda6f4 /lua.c
parentdb724e14e0b456a980f16a8adec4f20708c11af4 (diff)
downloadlua-3592c08a2c56b4378993825c62b47d483829b9b5.tar.gz
lua-3592c08a2c56b4378993825c62b47d483829b9b5.tar.bz2
lua-3592c08a2c56b4378993825c62b47d483829b9b5.zip
avoid printing two copyright messages with '-v -i' options
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lua.c b/lua.c
index 7aec6d1b..d795ece7 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.153 2005/10/21 13:48:31 roberto Exp roberto $ 2** $Id: lua.c,v 1.154 2005/10/24 17:38:47 roberto Exp roberto $
3** Lua stand-alone interpreter 3** Lua stand-alone interpreter
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -215,7 +215,6 @@ static void dotty (lua_State *L) {
215 int status; 215 int status;
216 const char *oldprogname = progname; 216 const char *oldprogname = progname;
217 progname = NULL; 217 progname = NULL;
218 print_version();
219 while ((status = loadline(L)) != -1) { 218 while ((status = loadline(L)) != -1) {
220 if (status == 0) status = docall(L, 0, 0); 219 if (status == 0) status = docall(L, 0, 0);
221 report(L, status); 220 report(L, status);
@@ -261,7 +260,7 @@ static int collectargs (char **argv, int *pi, int *pv, int *pe) {
261 switch (argv[i][1]) { /* option */ 260 switch (argv[i][1]) { /* option */
262 case '-': return (argv[i+1] != NULL ? i+1 : 0); 261 case '-': return (argv[i+1] != NULL ? i+1 : 0);
263 case '\0': return i; 262 case '\0': return i;
264 case 'i': *pi = 1; break; 263 case 'i': *pi = 1; /* go through */
265 case 'v': *pv = 1; break; 264 case 'v': *pv = 1; break;
266 case 'e': *pe = 1; /* go through */ 265 case 'e': *pe = 1; /* go through */
267 case 'l': 266 case 'l':
@@ -348,7 +347,10 @@ static int pmain (lua_State *L) {
348 if (has_i) 347 if (has_i)
349 dotty(L); 348 dotty(L);
350 else if (script == 0 && !has_e && !has_v) { 349 else if (script == 0 && !has_e && !has_v) {
351 if (lua_stdin_is_tty()) dotty(L); 350 if (lua_stdin_is_tty()) {
351 print_version();
352 dotty(L);
353 }
352 else dofile(L, NULL); /* executes stdin as a file */ 354 else dofile(L, NULL); /* executes stdin as a file */
353 } 355 }
354 return 0; 356 return 0;