sh: Allow unsetting OPTIND.

Note that only assigning the decimal value 1 resets getopts, as before.
This commit is contained in:
Jilles Tjoelker 2011-11-20 21:48:50 +00:00
parent f73031b47f
commit bf3db314f7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=227773
2 changed files with 6 additions and 2 deletions

View File

@ -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;
}
}
/*

View File

@ -0,0 +1,3 @@
# $FreeBSD$
unset OPTIND && [ -z "$OPTIND" ]