fixing console-mode vs. -e

This commit is contained in:
Enno Rehling 2009-08-22 08:59:57 +00:00
parent e01bf1bd2f
commit a92a8b1b7a
1 changed files with 6 additions and 3 deletions

View File

@ -174,7 +174,7 @@ static const char * luafile = NULL;
static const char * preload = NULL; static const char * preload = NULL;
static const char * script_path = "scripts"; static const char * script_path = "scripts";
static int memdebug = 0; static int memdebug = 0;
static int g_console = 1;
#if defined(HAVE_SIGACTION) && defined(HAVE_EXECINFO) #if defined(HAVE_SIGACTION) && defined(HAVE_EXECINFO)
#include <execinfo.h> #include <execinfo.h>
#include <signal.h> #include <signal.h>
@ -475,12 +475,14 @@ read_args(int argc, char **argv, lua_State * luaState)
return usage(argv[0], argv[i]); return usage(argv[0], argv[i]);
} else switch(argv[i][1]) { } else switch(argv[i][1]) {
case 'C': case 'C':
g_console = 1;
luafile=NULL; luafile=NULL;
break; break;
case 'o': case 'o':
g_reportdir = argv[++i]; g_reportdir = argv[++i];
break; break;
case 'e': case 'e':
g_console = 0;
luafile = argv[++i]; luafile = argv[++i];
break; break;
case 'd': case 'd':
@ -496,6 +498,7 @@ read_args(int argc, char **argv, lua_State * luaState)
xmlfile = argv[++i]; xmlfile = argv[++i];
break; break;
case 't': case 't':
g_console = 0;
turn = atoi(argv[++i]); turn = atoi(argv[++i]);
break; break;
case 'q': case 'q':
@ -716,8 +719,8 @@ main(int argc, char *argv[])
filename = strtok(NULL, ":"); filename = strtok(NULL, ":");
} }
} }
if (luafile==NULL || turn==0) lua_console(L); if (g_console) lua_console(L);
else { else if (luafile) {
char buf[MAX_PATH]; char buf[MAX_PATH];
if (script_path) { if (script_path) {
sprintf(buf, "%s/%s", script_path, luafile); sprintf(buf, "%s/%s", script_path, luafile);