diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-11 01:32:46 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-11 01:32:46 +0200 |
commit | 74d40589288890fffea437ed2f38ad1f2dc740e5 (patch) | |
tree | fafc1724b3b2c11280c067eaa4eaabb57e5f34cd /shell/ash_test | |
parent | 4628945cd8d4679912f126d5f18f954210abb7d0 (diff) | |
download | busybox-w32-74d40589288890fffea437ed2f38ad1f2dc740e5.tar.gz busybox-w32-74d40589288890fffea437ed2f38ad1f2dc740e5.tar.bz2 busybox-w32-74d40589288890fffea437ed2f38ad1f2dc740e5.zip |
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 <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test')
-rw-r--r-- | shell/ash_test/ash-getopts/getopt_positional.right | 6 | ||||
-rwxr-xr-x | shell/ash_test/ash-getopts/getopt_positional.tests | 8 |
2 files changed, 14 insertions, 0 deletions
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 @@ | |||
1 | *** no OPTIND, optstring:'we' args:-q -w -e r -t -y | ||
2 | Illegal option -q | ||
3 | var:'?' OPTIND:2 | ||
4 | var:'w' OPTIND:3 | ||
5 | var:'e' OPTIND:4 | ||
6 | 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 @@ | |||
1 | set -- -q -w -e r -t -y | ||
2 | echo "*** no OPTIND, optstring:'we' args:$*" | ||
3 | var=QWERTY | ||
4 | while getopts "we" var; do | ||
5 | echo "var:'$var' OPTIND:$OPTIND" | ||
6 | done | ||
7 | # unfortunately, "rc:0" is shown since while's overall exitcode is "success" | ||
8 | echo "exited: var:'$var' OPTIND:$OPTIND" | ||