diff options
author | Helmut Grohne <helmut@subdivi.de> | 2023-01-08 21:04:15 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2023-01-08 21:09:45 +0100 |
commit | 6954937b2288ece3d98a034c5764644c50550a30 (patch) | |
tree | 9348129c62cd64a86bc5d3a16e6f0829281ad29c | |
parent | 85026e3f708d163c90c623cad6c93024b357fc4e (diff) | |
download | debvm-6954937b2288ece3d98a034c5764644c50550a30.tar.gz |
debvm-waitssh: don't apply -q to usage errors and further port check
-rwxr-xr-x | debvm-waitssh | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/debvm-waitssh b/debvm-waitssh index e4f05ee..9e61a64 100755 --- a/debvm-waitssh +++ b/debvm-waitssh @@ -28,7 +28,8 @@ Defaults to one minute. =item B<-q>, B<--quiet> -Be quiet. Output nothing on standard error, not even error messages. +Be quiet. +Do not output a message when the timeout has been reached without success. =back @@ -144,12 +145,8 @@ case "$1" in esac case "$HOST" in *@*) - if [ "$VERBOSITY" -ge 1 ]; then - echo "$0: hostname '$HOST' must not contain the '@' character. No username is required." >&2 - fi - exit 2 - ;; -esac + die "$0: hostname '$HOST' must not contain the '@' character. No username is required." +;; esac # Guard against strings containing anything but digits, strings starting with # zero and empty strings as the port number. @@ -157,12 +154,11 @@ esac # We cannot use [!0-9] because that matches on any character (or possibly # multi-character collation element) that sorts in between 0 and 9. case "$PORT" in *[!0123456789]*|0?*|""|??????*) - if [ "$VERBOSITY" -ge 1 ]; then - echo "$0: port '$PORT' is not a positive integer between 1 and 99999" >&2 - fi - exit 2 - ;; -esac + die "$0: port '$PORT' is not a positive integer between 1 and 65535" +;; esac +if test "$PORT" -lt 1 -o "$PORT" -gt 65535; then + die "$0: port '$PORT' is not a positive integer between 1 and 65535" +fi now=$(date +%s) deadline=$((now + TOTALTIMEOUT)) |