diff options
Diffstat (limited to 'lua.c')
-rw-r--r-- | lua.c | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.82 2002/04/09 20:19:06 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.83 2002/04/22 14:40:50 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 | */ |
@@ -25,7 +25,7 @@ static int isatty (int x) { return x==0; } /* assume stdin is a tty */ | |||
25 | 25 | ||
26 | 26 | ||
27 | #ifndef LUA_PROGNAME | 27 | #ifndef LUA_PROGNAME |
28 | #define LUA_PROGNAME "lua: " | 28 | #define LUA_PROGNAME "lua" |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | 31 | ||
@@ -69,7 +69,7 @@ static void laction (int i) { | |||
69 | /* Lua gives no message in such cases, so we provide one */ | 69 | /* Lua gives no message in such cases, so we provide one */ |
70 | static void report (int result) { | 70 | static void report (int result) { |
71 | if (result == LUA_ERRMEM || result == LUA_ERRERR) | 71 | if (result == LUA_ERRMEM || result == LUA_ERRERR) |
72 | fprintf(stderr, "%s%s\n", LUA_PROGNAME, luaL_errstr(result)); | 72 | fprintf(stderr, "%s: %s\n", LUA_PROGNAME, luaL_errstr(result)); |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
@@ -88,7 +88,7 @@ static int ldo (int (*f)(lua_State *l, const char *), const char *name, | |||
88 | 88 | ||
89 | static void print_usage (void) { | 89 | static void print_usage (void) { |
90 | fprintf(stderr, | 90 | fprintf(stderr, |
91 | "usage: lua [options]. Available options are:\n" | 91 | "usage: %s [options]. Available options are:\n" |
92 | " - execute stdin as a file\n" | 92 | " - execute stdin as a file\n" |
93 | " -c close Lua when exiting\n" | 93 | " -c close Lua when exiting\n" |
94 | " -e stat execute string `stat'\n" | 94 | " -e stat execute string `stat'\n" |
@@ -96,8 +96,8 @@ static void print_usage (void) { | |||
96 | " -i enter interactive mode\n" | 96 | " -i enter interactive mode\n" |
97 | " -v print version information\n" | 97 | " -v print version information\n" |
98 | " a=b set global `a' to string `b'\n" | 98 | " a=b set global `a' to string `b'\n" |
99 | " name execute file `name'\n" | 99 | " name execute file `name'\n", |
100 | ); | 100 | LUA_PROGNAME); |
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
@@ -141,7 +141,7 @@ static int file_input (const char *name) { | |||
141 | int result = ldo(lua_dofile, name, 1); | 141 | int result = ldo(lua_dofile, name, 1); |
142 | if (result) { | 142 | if (result) { |
143 | if (result == LUA_ERRFILE) { | 143 | if (result == LUA_ERRFILE) { |
144 | fprintf(stderr, "%s%s ", LUA_PROGNAME, luaL_errstr(result)); | 144 | fprintf(stderr, "%s: %s ", LUA_PROGNAME, luaL_errstr(result)); |
145 | perror(name); | 145 | perror(name); |
146 | } | 146 | } |
147 | return EXIT_FAILURE; | 147 | return EXIT_FAILURE; |
@@ -301,8 +301,8 @@ static int handle_argv (char *argv[], int *toclose) { | |||
301 | return EXIT_FAILURE; | 301 | return EXIT_FAILURE; |
302 | } | 302 | } |
303 | if (ldo(lua_dostring, argv[i], 1) != 0) { | 303 | if (ldo(lua_dostring, argv[i], 1) != 0) { |
304 | fprintf(stderr, LUA_PROGNAME "error running argument `%.99s'\n", | 304 | fprintf(stderr, "%s: error running argument `%.99s'\n", |
305 | argv[i]); | 305 | LUA_PROGNAME, argv[i]); |
306 | return EXIT_FAILURE; | 306 | return EXIT_FAILURE; |
307 | } | 307 | } |
308 | break; | 308 | break; |
@@ -318,8 +318,9 @@ static int handle_argv (char *argv[], int *toclose) { | |||
318 | return file_input(argv[i]); /* stop scanning arguments */ | 318 | return file_input(argv[i]); /* stop scanning arguments */ |
319 | } | 319 | } |
320 | case 's': { | 320 | case 's': { |
321 | fprintf(stderr, LUA_PROGNAME | 321 | fprintf(stderr, |
322 | "option `-s' is deprecated (dynamic stack now)\n"); | 322 | "%s: option `-s' is deprecated (dynamic stack now)\n", |
323 | LUA_PROGNAME); | ||
323 | break; | 324 | break; |
324 | } | 325 | } |
325 | default: { | 326 | default: { |