summaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-10-18 14:06:33 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-10-18 14:06:33 -0200
commita122688091a3e9b43f694f14dd3994096fdfbb95 (patch)
tree0d1f5951539cc6dce510f85239d213d0b72bfee6 /lua.c
parentf3026c36c2373793d807c4deecd1fecaf33a9cef (diff)
downloadlua-a122688091a3e9b43f694f14dd3994096fdfbb95.tar.gz
lua-a122688091a3e9b43f694f14dd3994096fdfbb95.tar.bz2
lua-a122688091a3e9b43f694f14dd3994096fdfbb95.zip
better error message for 'lua -e -i'
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lua.c b/lua.c
index 5f68dd55..1d6f9c58 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.191 2010/07/02 17:36:32 roberto Exp roberto $ 2** $Id: lua.c,v 1.192 2010/07/25 15:03:37 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*/
@@ -369,10 +369,11 @@ static int collectargs (char **argv, int *pi, int *pv, int *pe) {
369 break; 369 break;
370 case 'e': 370 case 'e':
371 *pe = 1; /* go through */ 371 *pe = 1; /* go through */
372 case 'l': 372 case 'l': /* both options need an argument */
373 if (argv[i][2] == '\0') { 373 if (argv[i][2] == '\0') { /* no concatenated argument? */
374 i++; 374 i++; /* try next 'argv' */
375 if (argv[i] == NULL) return -(i - 1); 375 if (argv[i] == NULL || argv[i][0] == '-')
376 return -(i - 1); /* no next argument or it is another option */
376 } 377 }
377 break; 378 break;
378 default: /* invalid option; return its index... */ 379 default: /* invalid option; return its index... */