diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-30 12:42:59 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-30 12:42:59 -0300 |
| commit | 3a91274547051935f92a9a51e1fad276810c73a0 (patch) | |
| tree | dcf52962aa63919167f0d3b140c89904dfd05322 /lua.c | |
| parent | f2a813ae108a04e7de0478bd3c3ebf332268b043 (diff) | |
| download | lua-3a91274547051935f92a9a51e1fad276810c73a0.tar.gz lua-3a91274547051935f92a9a51e1fad276810c73a0.tar.bz2 lua-3a91274547051935f92a9a51e1fad276810c73a0.zip | |
details (avoid 'lint' warnings)
Diffstat (limited to 'lua.c')
| -rw-r--r-- | lua.c | 15 |
1 files changed, 7 insertions, 8 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.c,v 1.223 2015/03/09 21:57:05 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.224 2015/03/10 14:15:06 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 | */ |
| @@ -485,14 +485,14 @@ static int collectargs (char **argv, int *first) { | |||
| 485 | args |= has_E; | 485 | args |= has_E; |
| 486 | break; | 486 | break; |
| 487 | case 'i': | 487 | case 'i': |
| 488 | args |= has_i; /* goes through (-i implies -v) */ | 488 | args |= has_i; /* (-i implies -v) *//* FALLTHROUGH */ |
| 489 | case 'v': | 489 | case 'v': |
| 490 | if (argv[i][2] != '\0') /* extra characters after 1st? */ | 490 | if (argv[i][2] != '\0') /* extra characters after 1st? */ |
| 491 | return has_error; /* invalid option */ | 491 | return has_error; /* invalid option */ |
| 492 | args |= has_v; | 492 | args |= has_v; |
| 493 | break; | 493 | break; |
| 494 | case 'e': | 494 | case 'e': |
| 495 | args |= has_e; /* go through */ | 495 | args |= has_e; /* FALLTHROUGH */ |
| 496 | case 'l': /* both options need an argument */ | 496 | case 'l': /* both options need an argument */ |
| 497 | if (argv[i][2] == '\0') { /* no concatenated argument? */ | 497 | if (argv[i][2] == '\0') { /* no concatenated argument? */ |
| 498 | i++; /* try next 'argv' */ | 498 | i++; /* try next 'argv' */ |
| @@ -516,17 +516,16 @@ static int collectargs (char **argv, int *first) { | |||
| 516 | static int runargs (lua_State *L, char **argv, int n) { | 516 | static int runargs (lua_State *L, char **argv, int n) { |
| 517 | int i; | 517 | int i; |
| 518 | for (i = 1; i < n; i++) { | 518 | for (i = 1; i < n; i++) { |
| 519 | int status; | ||
| 520 | int option = argv[i][1]; | 519 | int option = argv[i][1]; |
| 521 | lua_assert(argv[i][0] == '-'); /* already checked */ | 520 | lua_assert(argv[i][0] == '-'); /* already checked */ |
| 522 | if (option == 'e' || option == 'l') { | 521 | if (option == 'e' || option == 'l') { |
| 522 | int status; | ||
| 523 | const char *extra = argv[i] + 2; /* both options need an argument */ | 523 | const char *extra = argv[i] + 2; /* both options need an argument */ |
| 524 | if (*extra == '\0') extra = argv[++i]; | 524 | if (*extra == '\0') extra = argv[++i]; |
| 525 | lua_assert(extra != NULL); | 525 | lua_assert(extra != NULL); |
| 526 | if (option == 'e') | 526 | status = (option == 'e') |
| 527 | status = dostring(L, extra, "=(command line)"); | 527 | ? dostring(L, extra, "=(command line)") |
| 528 | else | 528 | : dolibrary(L, extra); |
| 529 | status = dolibrary(L, extra); | ||
| 530 | if (status != LUA_OK) return 0; | 529 | if (status != LUA_OK) return 0; |
| 531 | } | 530 | } |
| 532 | } | 531 | } |
