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>
This commit is contained in:
Denys Vlasenko
2017-08-11 01:32:46 +02:00
parent 4628945cd8
commit 74d4058928
7 changed files with 212 additions and 2 deletions

View File

@@ -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

View File

@@ -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"