From 74d40589288890fffea437ed2f38ad1f2dc740e5 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 11 Aug 2017 01:32:46 +0200 Subject: hush: getopts builtin function old new delta builtin_getopts - 271 +271 bltins1 372 384 +12 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 283/0) Total: 283 bytes Signed-off-by: Denys Vlasenko --- shell/ash_test/ash-getopts/getopt_positional.right | 6 ++++++ shell/ash_test/ash-getopts/getopt_positional.tests | 8 ++++++++ 2 files changed, 14 insertions(+) create mode 100644 shell/ash_test/ash-getopts/getopt_positional.right create mode 100755 shell/ash_test/ash-getopts/getopt_positional.tests (limited to 'shell/ash_test/ash-getopts') diff --git a/shell/ash_test/ash-getopts/getopt_positional.right b/shell/ash_test/ash-getopts/getopt_positional.right new file mode 100644 index 000000000..37d0ec845 --- /dev/null +++ b/shell/ash_test/ash-getopts/getopt_positional.right @@ -0,0 +1,6 @@ +*** no OPTIND, optstring:'we' args:-q -w -e r -t -y +Illegal option -q +var:'?' OPTIND:2 +var:'w' OPTIND:3 +var:'e' OPTIND:4 +exited: var:'?' OPTIND:4 diff --git a/shell/ash_test/ash-getopts/getopt_positional.tests b/shell/ash_test/ash-getopts/getopt_positional.tests new file mode 100755 index 000000000..a5404a2a0 --- /dev/null +++ b/shell/ash_test/ash-getopts/getopt_positional.tests @@ -0,0 +1,8 @@ +set -- -q -w -e r -t -y +echo "*** no OPTIND, optstring:'we' args:$*" +var=QWERTY +while getopts "we" var; do + echo "var:'$var' OPTIND:$OPTIND" +done +# unfortunately, "rc:0" is shown since while's overall exitcode is "success" +echo "exited: var:'$var' OPTIND:$OPTIND" -- cgit v1.2.3