Showing the changes to src/lua.c (1 of 40 files). Show all
Unified · Split
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lua.c,v 1.192 2010/07/25 15:03:37 roberto Exp $ | |
| 2 | +** $Id: lua.c,v 1.194 2010/10/25 19:01:37 roberto Exp $ | |
| 3 | 3 | ** Lua stand-alone interpreter |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -369,10 +369,11 @@ static int collectargs (char **argv, int *pi, int *pv, int *pe) { · 363 unmodified lines | ||
| 369 | 369 | break; |
| 370 | 370 | case 'e': |
| 371 | 371 | *pe = 1; /* go through */ |
| 372 | − case 'l': | |
| 373 | − if (argv[i][2] == '\0') { | |
| 374 | − i++; | |
| 375 | − if (argv[i] == NULL) return -(i - 1); | |
| 372 | + case 'l': /* both options need an argument */ | |
| 373 | + if (argv[i][2] == '\0') { /* no concatenated argument? */ | |
| 374 | + i++; /* try next 'argv' */ | |
| 375 | + if (argv[i] == NULL || argv[i][0] == '-') | |
| 376 | + return -(i - 1); /* no next argument or it is another option */ | |
| 376 | 377 | } |
| 377 | 378 | break; |
| 378 | 379 | default: /* invalid option; return its index... */ |
| @@ -427,7 +428,7 @@ static int handle_luainit (lua_State *L) { · 48 unmodified lines | ||
| 427 | 428 | |
| 428 | 429 | |
| 429 | 430 | static int pmain (lua_State *L) { |
| 430 | − int argc = lua_tointeger(L, 1); | |
| 431 | + int argc = (int)lua_tointeger(L, 1); | |
| 431 | 432 | char **argv = (char **)lua_touserdata(L, 2); |
| 432 | 433 | int script; |
| 433 | 434 | int has_i = 0, has_v = 0, has_e = 0; |