Simplify long-option processing
MFC after: 3 days X-MFC-to: stable/10
This commit is contained in:
parent
0e4166b711
commit
e5e9551177
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user