summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysrc
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2015-09-01 22:37:33 +0000
committerdteske <dteske@FreeBSD.org>2015-09-01 22:37:33 +0000
commite5e9551177698959c63642dc899936a8c798ca48 (patch)
treeefa8734d17bd61d15ca9e5067d339fe484ba5034 /usr.sbin/sysrc
parent0e4166b711eedb35a2975aaf5e3e3f6949966c66 (diff)
downloadFreeBSD-src-e5e9551177698959c63642dc899936a8c798ca48.zip
FreeBSD-src-e5e9551177698959c63642dc899936a8c798ca48.tar.gz
Simplify long-option processing
MFC after: 3 days X-MFC-to: stable/10
Diffstat (limited to 'usr.sbin/sysrc')
-rw-r--r--usr.sbin/sysrc/sysrc24
1 files changed, 10 insertions, 14 deletions
diff --git a/usr.sbin/sysrc/sysrc b/usr.sbin/sysrc/sysrc
index 4ee9031..c672dd1 100644
--- a/usr.sbin/sysrc/sysrc
+++ b/usr.sbin/sysrc/sysrc
@@ -231,20 +231,16 @@ escape()
#
# Check for `--help' and `--version' command-line option
#
-( # Operate in sub-shell to protect $@ in parent
- while [ $# -gt 0 ]; do
- case "$1" in
- --help) help ;;
- --version) # see GLOBALS
- echo "$SYSRC_VERSION"
- exit 1 ;;
- -[fRj]) # These flags take an argument
- shift 1 ;;
- esac
- shift 1
- done
- exit 0
-) || die
+for arg in "$@"; do
+ case "$arg" in
+ --) break ;;
+ --help) help ;; # NOTREACHED
+ --version) # see GLOBALS
+ echo "$SYSRC_VERSION"
+ exit $FAILURE ;;
+ esac
+done
+unset arg
#
# Process command-line flags
OpenPOWER on IntegriCloud