This commit is contained in:
Roberto Ierusalimschy 2002-04-23 11:59:22 -03:00
parent ee4859b3e3
commit 151ba1cc7b
1 changed files with 12 additions and 11 deletions

23
lua.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: lua.c,v 1.82 2002/04/09 20:19:06 roberto Exp roberto $ ** $Id: lua.c,v 1.83 2002/04/22 14:40:50 roberto Exp roberto $
** Lua stand-alone interpreter ** Lua stand-alone interpreter
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -25,7 +25,7 @@ static int isatty (int x) { return x==0; } /* assume stdin is a tty */
#ifndef LUA_PROGNAME #ifndef LUA_PROGNAME
#define LUA_PROGNAME "lua: " #define LUA_PROGNAME "lua"
#endif #endif
@ -69,7 +69,7 @@ static void laction (int i) {
/* Lua gives no message in such cases, so we provide one */ /* Lua gives no message in such cases, so we provide one */
static void report (int result) { static void report (int result) {
if (result == LUA_ERRMEM || result == LUA_ERRERR) if (result == LUA_ERRMEM || result == LUA_ERRERR)
fprintf(stderr, "%s%s\n", LUA_PROGNAME, luaL_errstr(result)); fprintf(stderr, "%s: %s\n", LUA_PROGNAME, luaL_errstr(result));
} }
@ -88,7 +88,7 @@ static int ldo (int (*f)(lua_State *l, const char *), const char *name,
static void print_usage (void) { static void print_usage (void) {
fprintf(stderr, fprintf(stderr,
"usage: lua [options]. Available options are:\n" "usage: %s [options]. Available options are:\n"
" - execute stdin as a file\n" " - execute stdin as a file\n"
" -c close Lua when exiting\n" " -c close Lua when exiting\n"
" -e stat execute string `stat'\n" " -e stat execute string `stat'\n"
@ -96,8 +96,8 @@ static void print_usage (void) {
" -i enter interactive mode\n" " -i enter interactive mode\n"
" -v print version information\n" " -v print version information\n"
" a=b set global `a' to string `b'\n" " a=b set global `a' to string `b'\n"
" name execute file `name'\n" " name execute file `name'\n",
); LUA_PROGNAME);
} }
@ -141,7 +141,7 @@ static int file_input (const char *name) {
int result = ldo(lua_dofile, name, 1); int result = ldo(lua_dofile, name, 1);
if (result) { if (result) {
if (result == LUA_ERRFILE) { if (result == LUA_ERRFILE) {
fprintf(stderr, "%s%s ", LUA_PROGNAME, luaL_errstr(result)); fprintf(stderr, "%s: %s ", LUA_PROGNAME, luaL_errstr(result));
perror(name); perror(name);
} }
return EXIT_FAILURE; return EXIT_FAILURE;
@ -301,8 +301,8 @@ static int handle_argv (char *argv[], int *toclose) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if (ldo(lua_dostring, argv[i], 1) != 0) { if (ldo(lua_dostring, argv[i], 1) != 0) {
fprintf(stderr, LUA_PROGNAME "error running argument `%.99s'\n", fprintf(stderr, "%s: error running argument `%.99s'\n",
argv[i]); LUA_PROGNAME, argv[i]);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
break; break;
@ -318,8 +318,9 @@ static int handle_argv (char *argv[], int *toclose) {
return file_input(argv[i]); /* stop scanning arguments */ return file_input(argv[i]); /* stop scanning arguments */
} }
case 's': { case 's': {
fprintf(stderr, LUA_PROGNAME fprintf(stderr,
"option `-s' is deprecated (dynamic stack now)\n"); "%s: option `-s' is deprecated (dynamic stack now)\n",
LUA_PROGNAME);
break; break;
} }
default: { default: {