summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-11-20 21:48:50 +0000
committerjilles <jilles@FreeBSD.org>2011-11-20 21:48:50 +0000
commit1018bfcafa1ffa3a59e5bdd4b957a0282afc2f12 (patch)
treefb3cfbbb7119330e418d411dac19dde88b90c1bd /bin/sh
parentd19e8d9a37f12e934f0fd8d4803dfa41b596be32 (diff)
downloadFreeBSD-src-1018bfcafa1ffa3a59e5bdd4b957a0282afc2f12.zip
FreeBSD-src-1018bfcafa1ffa3a59e5bdd4b957a0282afc2f12.tar.gz
sh: Allow unsetting OPTIND.
Note that only assigning the decimal value 1 resets getopts, as before.
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/options.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/sh/options.c b/bin/sh/options.c
index 9104e93..4c2c8ab 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;
- }
}
/*
OpenPOWER on IntegriCloud