Browse Source

better error message for 'lua -e -i'

pull/9/head
Roberto Ierusalimschy 14 years ago
parent
commit
a122688091
  1. 11
      lua.c

11
lua.c

@ -1,5 +1,5 @@
/* /*
** $Id: lua.c,v 1.191 2010/07/02 17:36:32 roberto Exp roberto $ ** $Id: lua.c,v 1.192 2010/07/25 15:03:37 roberto Exp roberto $
** Lua stand-alone interpreter ** Lua stand-alone interpreter
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -369,10 +369,11 @@ static int collectargs (char **argv, int *pi, int *pv, int *pe) {
break; break;
case 'e': case 'e':
*pe = 1; /* go through */ *pe = 1; /* go through */
case 'l': case 'l': /* both options need an argument */
if (argv[i][2] == '\0') { if (argv[i][2] == '\0') { /* no concatenated argument? */
i++; i++; /* try next 'argv' */
if (argv[i] == NULL) return -(i - 1); if (argv[i] == NULL || argv[i][0] == '-')
return -(i - 1); /* no next argument or it is another option */
} }
break; break;
default: /* invalid option; return its index... */ default: /* invalid option; return its index... */

Loading…
Cancel
Save