summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-08-14 21:59:48 +0000
committerjilles <jilles@FreeBSD.org>2013-08-14 21:59:48 +0000
commitc71191e0d97a48198916f84fc4f1fd5c155af088 (patch)
tree9830ff1f61e27b9d9674599d547d49616ade0caa
parent1201f3dac8c8e346ee33754cd8ecfd09c250d2e2 (diff)
downloadFreeBSD-src-c71191e0d97a48198916f84fc4f1fd5c155af088.zip
FreeBSD-src-c71191e0d97a48198916f84fc4f1fd5c155af088.tar.gz
sh: Recognize "--" as end of options in local builtin.
-rw-r--r--bin/sh/var.c1
-rw-r--r--tools/regression/bin/sh/builtins/local4.012
2 files changed, 13 insertions, 0 deletions
diff --git a/bin/sh/var.c b/bin/sh/var.c
index 0de13fe..c20d032 100644
--- a/bin/sh/var.c
+++ b/bin/sh/var.c
@@ -710,6 +710,7 @@ localcmd(int argc __unused, char **argv __unused)
{
char *name;
+ nextopt("");
if (! in_function())
error("Not in a function");
while ((name = *argptr++) != NULL) {
diff --git a/tools/regression/bin/sh/builtins/local4.0 b/tools/regression/bin/sh/builtins/local4.0
new file mode 100644
index 0000000..3955aaa
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/local4.0
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+f() {
+ local -- x
+ x=2
+ [ "$x" = 2 ]
+}
+x=1
+f || exit 3
+[ "$x" = 1 ] || exit 3
+f || exit 3
+[ "$x" = 1 ] || exit 3
OpenPOWER on IntegriCloud