From 846d629c47088a0f3983f9ca4593f66da2d21549 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 26 Jun 2015 12:55:34 -0700 Subject: [PATCH] Eliminate the usage() function in lib.cli-std Signed-off-by: Tom Eastep --- Shorewall-core/lib.cli | 51 +++++++++++++++++++--- Shorewall/lib.cli-std | 96 ------------------------------------------ 2 files changed, 46 insertions(+), 101 deletions(-) diff --git a/Shorewall-core/lib.cli b/Shorewall-core/lib.cli index 28e8bc564..679fcaa0a 100644 --- a/Shorewall-core/lib.cli +++ b/Shorewall-core/lib.cli @@ -3862,6 +3862,9 @@ run_command() { fi } +ecko() { + [ -z "$g_lite" ] && echo "$@" +} # # Give Usage Information # @@ -3871,13 +3874,16 @@ usage() # $1 = exit status echo "where is one of:" echo " add [:] ... " echo " allow
..." + ecko " [ check | ck ] [ -e ] [ -r ] [ -p ] [ -r ] [ -T ] [ -i ] [ ]" echo " clear" + ecko " [ compile | co ] [ -e ] [ -p ] [ -t ] [ -c ] [ -d ] [ -T ] [ -i ] [ ] [ ]" echo " close [ [ ] ]" echo " delete [:] ... " echo " disable " echo " drop
..." echo " dump [ -x ] [ -l ] [ -m ]" echo " enable " + ecko " export [ ] [@][:]" echo " forget [ ]" echo " help" @@ -3887,21 +3893,46 @@ usage() # $1 = exit status echo " iprange
-
" fi + if [ $g_family -eq 4 ]; then + echo " iptrace " + else + echo " iptrace " + fi + + ecko " load [ -s ] [ -c ] [ -r ] [ -T ] [ -i ] [ ] " echo " logdrop
..." echo " logreject
..." echo " logwatch []" + + if [ $g_family -eq 4 ]; then + echo " noiptrace " + else + echo " noiptrace " + fi + echo " open [ [ ] ]" - echo " reject
..." echo " reenable " + ecko " refresh [ -d ] [ -n ] [ -T ] [ -D ] [ ... ]" + echo " reject
..." + ecko " reload [ -s ] [ -c ] [ -r ] [ -T ] [ -i ] [ ] " echo " reset [ ... ]" - echo " restart [ -n ] [ -p ] [ -f ] [ -C ] [ ]" + + if [ -n "$g_lite" ]; then + echo " restart [ -n ] [ -p ] [ -f ] [ -C ] [ ]" + else + echo " restart [ -n ] [ -p ] [-d] [ -f ] [ -c ] [ -T ] [ -i ] [ -C ] [ ]" + fi + echo " restore [ -n ] [ -p ] [ -C ] [ ]" echo " run [ ... ]" + ecko " safe-restart [ -t ] [ ]" + ecko " safe-start [ -t ] [ ]" echo " save [ -C ] [ ]" echo " savesets" echo " [ show | list | ls ] [ -b ] [ -x ] [ -t {filter|mangle|nat} ] [ {chain [ [ ... ]" - echo " [ show | list | ls ] [ -f ] capabilities" + ecko " [ show | list | ls ] actions" echo " [ show | list | ls ] arptables" + echo " [ show | list | ls ] [ -f ] capabilities" echo " [ show | list | ls ] [ -x ] {bl|blacklists}" echo " [ show | list | ls ] classifiers" echo " [ show | list | ls ] config" @@ -3917,6 +3948,8 @@ usage() # $1 = exit status echo " [ show | list | ls ] [ -m ] log []" echo " [ show | list | ls ] [ -x ] mangle|nat|raw|rawpost" + ecko " [ show | list | ls ] macro " + ecko " [ show | list | ls ] macros" echo " [ show | list | ls ] nfacct" echo " [ show | list | ls ] opens" echo " [ show | list | ls ] policies" @@ -3924,9 +3957,17 @@ usage() # $1 = exit status echo " [ show | list | ls ] tc [ device ]" echo " [ show | list | ls ] vardir" echo " [ show | list | ls ] zones" - echo " start [ -f ] [ -p ] [ -C ] [ ]" - echo " stop" + + if [ -n "$g_lite" ]; then + echo " start [ -f ] [ -p ] [ -C ] [ ]" + else + echo " start [ -f ] [ -n ] [ -p ] [ -c ] [ -T ] [ -i ] [ -C ] [ ]" + fi + echo " status [ -i ]" + echo " stop" + ecko " try [ ]" + ecko " update [ -a ] [ -b ] [ -r ] [ -T ] [ -D ] [ -i ] [-t] [-A] [ ]" echo " version [ -a ]" echo exit $1 diff --git a/Shorewall/lib.cli-std b/Shorewall/lib.cli-std index ac56ab075..a13f0936f 100644 --- a/Shorewall/lib.cli-std +++ b/Shorewall/lib.cli-std @@ -1663,102 +1663,6 @@ run_command() { fi } -# -# Give Usage Information -# -usage() # $1 = exit status -{ - echo "Usage: $(basename $0) [debug|trace] [nolock] [ -q ] [ -v[-1|{0-2}] ] [ -t ] " - echo "where is one of:" - echo " add [:] ... " - echo " allow
..." - echo " [ check | ck ] [ -e ] [ -r ] [ -p ] [ -r ] [ -T ] [ -i ] [ ]" - echo " clear" - echo " close [ [ ] ]" - echo " [ compile | co ] [ -e ] [ -p ] [ -t ] [ -c ] [ -d ] [ -T ] [ -i ] [ ] [ ]" - echo " delete [:] ... " - echo " disable " - echo " drop
..." - echo " dump [ -x ] [ -l ] [ -m ]" - echo " enable " - echo " export [ ] [@][:]" - echo " forget [ ]" - echo " help" - - if [ $g_family -eq 4 ]; then - echo " hits [ -t ]" - echo " ipcalc {
/ |
}" - echo " ipdecimal {
| }" - echo " iprange
-
" - fi - - if [ $g_family -eq 4 ]; then - echo " iptrace " - else - echo " iptrace " - fi - - echo " load [ -s ] [ -c ] [ -r ] [ -T ] [ -i ] [ ] " - echo " logdrop
..." - echo " logreject
..." - echo " logwatch []" - - if [ $g_family -eq 4 ]; then - echo " noiptrace " - else - echo " noiptrace " - fi - - echo " open [ [ ] ]" - echo " reenable " - echo " refresh [ -d ] [ -n ] [ -T ] [ -D ] [ ... ]" - echo " reject
..." - echo " reload [ -s ] [ -c ] [ -r ] [ -T ] [ -i ] [ ] " - echo " reset [ ... ]" - echo " restart [ -n ] [ -p ] [-d] [ -f ] [ -c ] [ -T ] [ -i ] [ -C ] [ ]" - echo " restore [ -n ] [ -p ] [ -C ] [ ]" - echo " run [ ... ]" - echo " safe-restart [ -t ] [ ]" - echo " safe-start [ -t ] [ ]" - echo " save [ -C ] [ ]" - echo " savesets" - echo " [ show | list | ls ] [ -x ] [ -t {filter|mangle|nat|raw|rawpost} ] [ {chain [ [ ... ]" - echo " [ show | list | ls ] actions" - echo " [ show | list | ls ] [ -x ] {bl|blacklists}" - echo " [ show | list | ls ] [ -f ] capabilities" - echo " [ show | list | ls ] classifiers" - echo " [ show | list | ls ] config" - echo " [ show | list | ls ] connections" - echo " [ show | list | ls ] dynamic " - echo " [ show | list | ls ] filters" - echo " [ show | list | ls ] ip" - - if [ $g_family -eq 4 ]; then - echo " [ show | list | ls ] ipa" - fi - - echo " [ show | list | ls ] [ -m ] log []" - echo " [ show | list | ls ] macro " - echo " [ show | list | ls ] macros" - echo " [ show | list | ls ] marks" - echo " [ show | list | ls ] [ -x ] mangle|nat|raw|rawpost|routing" - echo " [ show | list | ls ] nfacct" - echo " [ show | list | ls ] opens" - echo " [ show | list | ls ] policies" - echo " [ show | list | ls ] routing" - echo " [ show | list | ls ] tc [ device ]" - echo " [ show | list | ls ] vardir" - echo " [ show | list | ls ] zones" - echo " start [ -f ] [ -n ] [ -p ] [ -c ] [ -T ] [ -i ] [ -C ] [ ]" - echo " status [ -i ]" - echo " stop" - echo " try [ ]" - echo " update [ -a ] [ -b ] [ -r ] [ -T ] [ -D ] [ -i ] [-t] [-A] [ ]" - echo " version [ -a ]" - echo - exit $1 -} - compiler_command() { case $COMMAND in