From 231845e6d91a4baf92b354753881286f49d577ef Mon Sep 17 00:00:00 2001 From: teastep Date: Wed, 15 Feb 2006 15:20:17 +0000 Subject: [PATCH] Add -t option to timestamp progress messages git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@3487 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/changelog.txt | 2 ++ Shorewall/functions | 21 ++++++++++++++++++--- Shorewall/shorewall | 8 ++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Shorewall/changelog.txt b/Shorewall/changelog.txt index 33de1f4fd..6aa3096cb 100755 --- a/Shorewall/changelog.txt +++ b/Shorewall/changelog.txt @@ -76,3 +76,5 @@ Changes in 3.1.x. 33) Remove superfluous rules in MAC validation. 34) Correct Makefile. + +35) Add -t option diff --git a/Shorewall/functions b/Shorewall/functions index 75e7eafdc..2be73c488 100755 --- a/Shorewall/functions +++ b/Shorewall/functions @@ -87,17 +87,32 @@ list_count() { # progress_message() # $* = Message { - [ $VERBOSE -gt 1 ] && echo "$@" + local timestamp= + + if [ $VERBOSE -gt 1 ]; then + [ -n "$TIMESTAMP" ] && timestamp="$(date +%H:%M:%S) " + echo "${timestamp}$@" + fi } progress_message2() # $* = Message { - [ $VERBOSE -gt 0 ] && echo "$@" + local timestamp= + + if [ $VERBOSE -gt 0 ]; then + [ -n "$TIMESTAMP" ] && timestamp="$(date +%H:%M:%S) " + echo "${timestamp}$@" + fi } progress_message3() # $* = Message { - [ $VERBOSE -ge 0 ] && echo "$@" + local timestamp= + + if [ $VERBOSE -ge 0 ]; then + [ -n "$TIMESTAMP" ] && timestamp="$(date +%H:%M:%S) " + echo "${timestamp}$@" + fi } # diff --git a/Shorewall/shorewall b/Shorewall/shorewall index 1a80e70f3..dc0681198 100755 --- a/Shorewall/shorewall +++ b/Shorewall/shorewall @@ -1294,7 +1294,7 @@ help() # usage() # $1 = exit status { - echo "Usage: $(basename $0) [debug|trace] [nolock] [ -q ] [ -v ] " + echo "Usage: $(basename $0) [debug|trace] [nolock] [ -q ] [ -v ] [ -t ] " echo "where is one of:" echo " add [:] ... " echo " allow
..." @@ -1417,6 +1417,7 @@ FAST= VERBOSE=0 NOROUTES= EXPORT= +export TIMESTAMP= noroutes= finished=0 @@ -1474,6 +1475,10 @@ while [ $finished -eq 0 ]; do NOROUTES=Yes option=${option#n} ;; + t*) + TIMESTAMP=Yes + option=${option#t} + ;; -) finished=1 option= @@ -1529,7 +1534,6 @@ else fi ensure_config_path - export CONFIG_PATH get_config