help message
This commit is contained in:
69
lua.c
69
lua.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lua.c,v 1.9 1997/12/11 17:00:21 roberto Exp roberto $
|
** $Id: lua.c,v 1.10 1997/12/19 18:34:23 roberto Exp roberto $
|
||||||
** Lua stand-alone interpreter
|
** Lua stand-alone interpreter
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -25,16 +25,20 @@
|
|||||||
#define isatty(x) (x==0) /* assume stdin is a tty */
|
#define isatty(x) (x==0) /* assume stdin is a tty */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* command line options:
|
|
||||||
** -v print version information (banner).
|
static void print_message (void)
|
||||||
** -d debug on
|
{
|
||||||
** -e dostring on next arg
|
fprintf(stderr,
|
||||||
** a=b sets global 'a' with string 'b'
|
"Lua: command line options:\n"
|
||||||
** -q interactive mode without prompt
|
" -v print version information\n"
|
||||||
** -i interactive mode with prompt
|
" -d turn debug on\n"
|
||||||
** - executes stdin as a file
|
" -e stat dostring `stat'\n"
|
||||||
** name dofile "name"
|
" -q interactive mode without prompt\n"
|
||||||
*/
|
" -i interactive mode with prompt\n"
|
||||||
|
" - executes stdin as a file\n"
|
||||||
|
" a=b sets global `a' with string `b'\n"
|
||||||
|
" name dofile `name'\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void assign (char *arg)
|
static void assign (char *arg)
|
||||||
@@ -104,22 +108,33 @@ int main (int argc, char *argv[])
|
|||||||
lua_dofile(NULL); /* executes stdin as a file */
|
lua_dofile(NULL); /* executes stdin as a file */
|
||||||
}
|
}
|
||||||
else for (i=1; i<argc; i++) {
|
else for (i=1; i<argc; i++) {
|
||||||
if (strcmp(argv[i], "-") == 0)
|
if (argv[i][0] == '-') { /* option? */
|
||||||
lua_dofile(NULL); /* executes stdin as a file */
|
switch (argv[i][1]) {
|
||||||
else if (strcmp(argv[i], "-i") == 0)
|
case 0:
|
||||||
manual_input(1);
|
lua_dofile(NULL); /* executes stdin as a file */
|
||||||
else if (strcmp(argv[i], "-q") == 0)
|
break;
|
||||||
manual_input(0);
|
case 'i':
|
||||||
else if (strcmp(argv[i], "-d") == 0)
|
manual_input(1);
|
||||||
lua_debug = 1;
|
break;
|
||||||
else if (strcmp(argv[i], "-v") == 0)
|
case 'q':
|
||||||
printf("%s %s\n(written by %s)\n\n",
|
manual_input(0);
|
||||||
LUA_VERSION, LUA_COPYRIGHT, LUA_AUTHORS);
|
break;
|
||||||
else if (strcmp(argv[i], "-e") == 0) {
|
case 'd':
|
||||||
i++;
|
lua_debug = 1;
|
||||||
if (lua_dostring(argv[i]) != 0) {
|
break;
|
||||||
fprintf(stderr, "lua: error running argument `%s'\n", argv[i]);
|
case 'v':
|
||||||
return 1;
|
printf("%s %s\n(written by %s)\n\n",
|
||||||
|
LUA_VERSION, LUA_COPYRIGHT, LUA_AUTHORS);
|
||||||
|
break;
|
||||||
|
case 'e':
|
||||||
|
i++;
|
||||||
|
if (lua_dostring(argv[i]) != 0) {
|
||||||
|
fprintf(stderr, "lua: error running argument `%s'\n", argv[i]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
print_message();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strchr(argv[i], '='))
|
else if (strchr(argv[i], '='))
|
||||||
|
|||||||
Reference in New Issue
Block a user