sh: Allow unsetting OPTIND.
Note that only assigning the decimal value 1 resets getopts, as before.
This commit is contained in:
parent
f73031b47f
commit
bf3db314f7
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
3
tools/regression/bin/sh/parameters/optind1.0
Normal file
3
tools/regression/bin/sh/parameters/optind1.0
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
|
||||
unset OPTIND && [ -z "$OPTIND" ]
|
Loading…
x
Reference in New Issue
Block a user