From 19b5663b9ef06a800831d09a3cbceb937923429d Mon Sep 17 00:00:00 2001 From: Mike Burns Date: Fri, 30 May 2014 14:17:32 +0200 Subject: On bad args, show usage and exit The lsrc(1), mkrc(1), rcup(1), and rcdn(1) commands will now print a usage message and exit immediately (with 64, `EX_USAGE`) when given an option it does not understand. This includes `--version` and `--help`. Normal `-h` will print usage and exit successfully, as normal. Closes #59. --- bin/rcup.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bin/rcup.in') diff --git a/bin/rcup.in b/bin/rcup.in index 17516b6..24d7177 100755 --- a/bin/rcup.in +++ b/bin/rcup.in @@ -107,7 +107,7 @@ handle_command_line() { local hostname= REPLACE_ALL=0 - while getopts CVqvfhikKI:x:S:t:d:B: opt; do + while getopts :CVqvfhikKI:x:S:t:d:B: opt; do case "$opt" in B) hostname="$OPTARG" ;; C) always_copy=1 ;; @@ -124,6 +124,7 @@ handle_command_line() { v) verbosity=$(($verbosity + 1)) ;; V) version=1 ;; x) excludes="$excludes $OPTARG" ;; + ?) show_help 64 ;; esac done shift $(($OPTIND-1)) -- cgit v1.2.3