From 3592c08a2c56b4378993825c62b47d483829b9b5 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 28 Nov 2005 12:44:48 -0200 Subject: avoid printing two copyright messages with '-v -i' options --- lua.c | 10 ++++++---- 1 file 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 @@ /* -** $Id: lua.c,v 1.153 2005/10/21 13:48:31 roberto Exp roberto $ +** $Id: lua.c,v 1.154 2005/10/24 17:38:47 roberto Exp roberto $ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ @@ -215,7 +215,6 @@ static void dotty (lua_State *L) { int status; const char *oldprogname = progname; progname = NULL; - print_version(); while ((status = loadline(L)) != -1) { if (status == 0) status = docall(L, 0, 0); report(L, status); @@ -261,7 +260,7 @@ static int collectargs (char **argv, int *pi, int *pv, int *pe) { switch (argv[i][1]) { /* option */ case '-': return (argv[i+1] != NULL ? i+1 : 0); case '\0': return i; - case 'i': *pi = 1; break; + case 'i': *pi = 1; /* go through */ case 'v': *pv = 1; break; case 'e': *pe = 1; /* go through */ case 'l': @@ -348,7 +347,10 @@ static int pmain (lua_State *L) { if (has_i) dotty(L); else if (script == 0 && !has_e && !has_v) { - if (lua_stdin_is_tty()) dotty(L); + if (lua_stdin_is_tty()) { + print_version(); + dotty(L); + } else dofile(L, NULL); /* executes stdin as a file */ } return 0; -- cgit v1.2.3-55-g6feb