From aa09279cea9f52c37d4c07acd51053f2de726203 Mon Sep 17 00:00:00 2001 From: jilles Date: Sat, 10 May 2014 19:18:49 +0000 Subject: sh: In getopts, unset OPTARG where POSIX says we should. --- bin/sh/tests/builtins/Makefile | 1 + bin/sh/tests/builtins/getopts8.0 | 8 ++++++++ bin/sh/tests/builtins/getopts8.0.stdout | 5 +++++ 3 files changed, 14 insertions(+) create mode 100644 bin/sh/tests/builtins/getopts8.0 create mode 100644 bin/sh/tests/builtins/getopts8.0.stdout (limited to 'bin/sh/tests/builtins') diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile index 054a3b8..7a71318 100644 --- a/bin/sh/tests/builtins/Makefile +++ b/bin/sh/tests/builtins/Makefile @@ -85,6 +85,7 @@ FILES+= getopts4.0 FILES+= getopts5.0 FILES+= getopts6.0 FILES+= getopts7.0 +FILES+= getopts8.0 getopts8.0.stdout FILES+= hash1.0 hash1.0.stdout FILES+= hash2.0 hash2.0.stdout FILES+= hash3.0 hash3.0.stdout diff --git a/bin/sh/tests/builtins/getopts8.0 b/bin/sh/tests/builtins/getopts8.0 new file mode 100644 index 0000000..da4af6b --- /dev/null +++ b/bin/sh/tests/builtins/getopts8.0 @@ -0,0 +1,8 @@ +# $FreeBSD$ + +set -- -yz -wx +opt=wrong1 OPTARG=wrong2 +while getopts :x opt; do + echo "$opt:${OPTARG-unset}" +done +echo "OPTIND=$OPTIND" diff --git a/bin/sh/tests/builtins/getopts8.0.stdout b/bin/sh/tests/builtins/getopts8.0.stdout new file mode 100644 index 0000000..f10cefc --- /dev/null +++ b/bin/sh/tests/builtins/getopts8.0.stdout @@ -0,0 +1,5 @@ +?:y +?:z +?:w +x:unset +OPTIND=3 -- cgit v1.1