summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-01-01 22:43:20 -0500
committerAllan McRae <allan@archlinux.org>2013-01-03 12:03:09 +1000
commit60d258819294e7b84c7ec501d9bfe6fe6965d41c (patch)
treebadf93362c922b97116ed8c5098ca57805a2ab7e
parent1dd3405813434e71ead02bdcb66b6da0544632c4 (diff)
downloadpacman-60d258819294e7b84c7ec501d9bfe6fe6965d41c.tar.xz
parseopts: remove superfluous continue/shift statements
Fun fact about bash: the below is valid and will only ever print 'a'! fn() { continue 2 } for x in {1..5}; do for y in {a..e}; do echo "$y" fn done done Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--scripts/library/parseopts.sh6
1 files changed, 1 insertions, 5 deletions
diff --git a/scripts/library/parseopts.sh b/scripts/library/parseopts.sh
index 11589ce3..cf6aa6c6 100644
--- a/scripts/library/parseopts.sh
+++ b/scripts/library/parseopts.sh
@@ -92,26 +92,22 @@ parseopts() {
# --longopt
else
OPTRET+=("--$opt")
- shift
- continue 2
fi
;;
1)
# --longopt=optarg
if [[ $optarg ]]; then
OPTRET+=("--$opt" "$optarg")
- shift
# --longopt optarg
elif [[ $2 ]]; then
OPTRET+=("--$opt" "$2" )
- shift 2
+ shift
# parse failure
else
printf "@SCRIPTNAME@: $(gettext "option '%s' requires an argument")\n" "--$opt" >&2
OPTRET=(--)
return 1
fi
- continue 2
;;
254)
# ambiguous option -- error was reported for us by longoptmatch()