From 5924ab71b5c299bf5e5620aa35e8875d1862cd60 Mon Sep 17 00:00:00 2001 From: teastep Date: Thu, 30 Nov 2006 17:17:53 +0000 Subject: [PATCH] Fix for 'show macros' where /bin/sh is a light-weight shell git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5025 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/lib.cli | 34 +++++++++++++++++++++++++++------- Shorewall/shorewall | 3 ++- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Shorewall/lib.cli b/Shorewall/lib.cli index dc95be248..bc8a4985c 100644 --- a/Shorewall/lib.cli +++ b/Shorewall/lib.cli @@ -361,6 +361,15 @@ show_routing() { show_command() { local finished=0 local table=filter + show_macro() { + foo=`grep 'This macro' $macro | sed 's/This macro //'` + if [ -n "$foo" ]; then + macro=${macro#*.} + foo=${foo%.*} + echo " $macro ${foo#\#}" + fi + } + while [ $finished -eq 0 -a $# -gt 0 ]; do option=$1 case $option in @@ -529,13 +538,24 @@ show_command() { ;; macros) [ $# -gt 1 ] && usage 1 - for macro in ${SHAREDIR}/macro.*; do - foo=`grep 'This macro' $macro | sed 's/This macro //'` - if [ -n "$foo" ]; then - macro=${macro#*.} - foo=${foo%.*} - echo " $macro ${foo#\#}" - fi + + for directory in $(split $CONFIG_PATH); do + temp= + for macro in ${directory}/macro.*; do + case $macro in + *\*) + ;; + *) + if [ -z "$temp" ]; then + echo + echo "Macros in $directory:" + echo + temp=Yes + fi + show_macro + ;; + esac + done done return ;; diff --git a/Shorewall/shorewall b/Shorewall/shorewall index b73c6ed3e..f4dbbf4ae 100755 --- a/Shorewall/shorewall +++ b/Shorewall/shorewall @@ -1209,7 +1209,8 @@ case "$COMMAND" in fi elif ! $IPTABLES -L shorewall > /dev/null 2> /dev/null; then $0 $VERBOSE $NOROUTES start - elif [ $# -eq 3 ]; the sleep $3 + elif [ $# -eq 3 ]; then + sleep $3 $0 $VERBOSE $NOROUTES restart fi ;;