From c446fb3735f6f5b95a54eb4de5f8bd00dad4ccc3 Mon Sep 17 00:00:00 2001 From: teastep Date: Thu, 22 Apr 2004 20:57:36 +0000 Subject: [PATCH] Clean up -q implementation git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@1284 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall2/firewall | 2 +- Shorewall2/releasenotes.txt | 10 +++--- Shorewall2/shorewall | 65 +++++++++++++++++++++++-------------- 3 files changed, 46 insertions(+), 31 deletions(-) diff --git a/Shorewall2/firewall b/Shorewall2/firewall index 6684850f4..92097f27c 100755 --- a/Shorewall2/firewall +++ b/Shorewall2/firewall @@ -53,7 +53,7 @@ my_mutex_off() { progress_message() # $* = Message { - [ -n "$QUIET" ] || echo $@ + [ -n "$QUIET" ] || echo "$@" } # diff --git a/Shorewall2/releasenotes.txt b/Shorewall2/releasenotes.txt index 88951bb3a..89775e84c 100755 --- a/Shorewall2/releasenotes.txt +++ b/Shorewall2/releasenotes.txt @@ -17,9 +17,9 @@ Issues when migrating from Shorewall 2.0.0 to Shorewall 2.0.1: 1) Dynamic Zone support. -If you don't need to use the "shorewall add" and "shorewall delete" -commands, you should set DYNAMIC_ZONES=No in -/etc/shorewall/shorewall.conf . + If you don't need to use the "shorewall add" and "shorewall delete" + commands, you should set DYNAMIC_ZONES=No in + /etc/shorewall/shorewall.conf. New Features: @@ -92,9 +92,9 @@ New Features: 7) A new "-q" option has been added to /sbin/shorewall commands. It causes the start, restart, check and refresh commands to produce - much less output so that warning messages are more visible. When + much less output so that warning messages are more visible (when testing this change, I discovered a bug where a bogus warning - message was being generated :-) + message was being generated). diff --git a/Shorewall2/shorewall b/Shorewall2/shorewall index f0f9727c2..604c1d2bd 100755 --- a/Shorewall2/shorewall +++ b/Shorewall2/shorewall @@ -592,33 +592,48 @@ done=0 while [ $done -eq 0 ]; do [ $# -eq 0 ] && usage 1 - case $1 in - -c) - [ $# -eq 1 ] && usage 1 + option=$1 + case $option in + -*) + option=${option#-} - if [ ! -d $2 ]; then - if [ -e $2 ]; then - echo "$2 is not a directory" >&2 && exit 2 - else - echo "Directory $2 does not exist" >&2 && exit 2 - fi - fi + [ "x$option" = x ] && usage 1 + + while [ "x$option" != x ]; do + case $option in + c) + [ $# -eq 1 ] && usage 1 - SHOREWALL_DIR=$2 - shift - shift - ;; - -x) - IPT_OPTIONS="-xnv" - shift - ;; - -q) - QUIET=Yes - shift - ;; - *) - done=1 - ;; + if [ ! -d $2 ]; then + if [ -e $2 ]; then + echo "$2 is not a directory" >&2 && exit 2 + else + echo "Directory $2 does not exist" >&2 && exit 2 + fi + fi + + SHOREWALL_DIR=$2 + option= + shift + ;; + x*) + IPT_OPTIONS="-xnv" + option=${option#x} + ;; + q*) + QUIET=Yes + option=${option#q} + ;; + *) + usage 1 + ;; + esac + done + shift + ;; + *) + done=1 + ;; esac done