* src/expr.c (main): Given a first argument like -22 (negative, with
two or more digits), expr would decrement optind to 0 and then attempt
to evaluate argv[0].
{
VALUE *v;
int c;
+ int saved_optind;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
/* The argument -0 should not result in an error message. */
opterr = 0;
+ saved_optind = 1;
while ((c = getopt_long (argc, argv, "+", long_options, NULL)) != -1)
{
*/
if ('?' == c)
{
- --optind;
+ optind = saved_optind;
break;
}
else
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
}
+ saved_optind = optind;
}
if (argc <= optind)