diff --git a/bin/sh/options.c b/bin/sh/options.c index 9104e93270fc..4c2c8ab8e3ec 100644 --- a/bin/sh/options.c +++ b/bin/sh/options.c @@ -401,9 +401,10 @@ setcmd(int argc, char **argv) void getoptsreset(const char *value) { - if (number(value) == 1) { + while (*value == '0') + value++; + if (strcmp(value, "1") == 0) shellparam.reset = 1; - } } /* diff --git a/tools/regression/bin/sh/parameters/optind1.0 b/tools/regression/bin/sh/parameters/optind1.0 new file mode 100644 index 000000000000..33e0288e861f --- /dev/null +++ b/tools/regression/bin/sh/parameters/optind1.0 @@ -0,0 +1,3 @@ +# $FreeBSD$ + +unset OPTIND && [ -z "$OPTIND" ]