diff options
-rw-r--r-- | bin/sh/var.c | 1 | ||||
-rw-r--r-- | tools/regression/bin/sh/builtins/local4.0 | 12 |
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 |