Eliminate some of the reserved all-caps variable names

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2010-02-22 08:05:23 -08:00
parent 6165a50e49
commit 55c9cf3e99
2 changed files with 71 additions and 89 deletions

View File

@ -462,7 +462,7 @@ show_command() {
option=${option#v} option=${option#v}
;; ;;
x*) x*)
IPT_OPTIONS="-xnv" g_ipt_options="-xnv"
option=${option#x} option=${option#x}
;; ;;
m*) m*)
@ -490,7 +490,7 @@ show_command() {
shift shift
;; ;;
l*) l*)
IPT_OPTIONS1="--line-numbers" g_ipt_options1="--line-numbers"
option=${option#l} option=${option#l}
;; ;;
*) *)
@ -506,7 +506,7 @@ show_command() {
esac esac
done done
IPT_OPTIONS="$IPT_OPTIONS $IPT_OPTIONS1" g_ipt_options="$g_ipt_options $g_ipt_options1"
[ -n "$debugging" ] && set -x [ -n "$debugging" ] && set -x
case "$1" in case "$1" in
@ -523,21 +523,21 @@ show_command() {
echo "$PRODUCT $version NAT Table at $HOSTNAME - $(date)" echo "$PRODUCT $version NAT Table at $HOSTNAME - $(date)"
echo echo
show_reset show_reset
$IPTABLES -t nat -L $IPT_OPTIONS $IPTABLES -t nat -L $g_ipt_options
;; ;;
raw) raw)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
echo "$PRODUCT $version RAW Table at $HOSTNAME - $(date)" echo "$PRODUCT $version RAW Table at $HOSTNAME - $(date)"
echo echo
show_reset show_reset
$IPTABLES -t raw -L $IPT_OPTIONS $IPTABLES -t raw -L $g_ipt_options
;; ;;
tos|mangle) tos|mangle)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Mangle Table at $HOSTNAME - $(date)" echo "$PRODUCT $version Mangle Table at $HOSTNAME - $(date)"
echo echo
show_reset show_reset
$IPTABLES -t mangle -L $IPT_OPTIONS $IPTABLES -t mangle -L $g_ipt_options
;; ;;
log) log)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
@ -618,11 +618,11 @@ show_command() {
show_reset show_reset
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
for chain in $*; do for chain in $*; do
$IPTABLES -t $table -L $chain $IPT_OPTIONS $IPTABLES -t $table -L $chain $g_ipt_options
echo echo
done done
else else
$IPTABLES -t $table -L $IPT_OPTIONS $IPTABLES -t $table -L $g_ipt_options
fi fi
;; ;;
vardir) vardir)
@ -709,7 +709,7 @@ show_command() {
fi fi
[ -n "$table_given" ] || for chain in $*; do [ -n "$table_given" ] || for chain in $*; do
if ! qt $IPTABLES -t $table -L $chain $IPT_OPTIONS; then if ! qt $IPTABLES -t $table -L $chain $g_ipt_options; then
error_message "ERROR: Chain '$chain' is not recognized by $IPTABLES." error_message "ERROR: Chain '$chain' is not recognized by $IPTABLES."
exit 1 exit 1
fi fi
@ -719,14 +719,14 @@ show_command() {
echo echo
show_reset show_reset
for chain in $*; do for chain in $*; do
$IPTABLES -t $table -L $chain $IPT_OPTIONS $IPTABLES -t $table -L $chain $g_ipt_options
echo echo
done done
else else
echo "$PRODUCT $version $table Table at $HOSTNAME - $(date)" echo "$PRODUCT $version $table Table at $HOSTNAME - $(date)"
echo echo
show_reset show_reset
$IPTABLES -t $table -L $IPT_OPTIONS $IPTABLES -t $table -L $g_ipt_options
fi fi
;; ;;
esac esac
@ -752,7 +752,7 @@ dump_command() {
option= option=
;; ;;
x*) x*)
IPT_OPTIONS="-xnv" g_ipt_options="-xnv"
option=${option#x} option=${option#x}
;; ;;
m*) m*)
@ -760,7 +760,7 @@ dump_command() {
option=${option#m} option=${option#m}
;; ;;
l*) l*)
IPT_OPTIONS1="--line-numbers" g_ipt_options1="--line-numbers"
option=${option#l} option=${option#l}
;; ;;
*) *)
@ -776,7 +776,7 @@ dump_command() {
esac esac
done done
IPT_OPTIONS="$IPT_OPTIONS $IPT_OPTIONS1" g_ipt_options="$g_ipt_options $g_ipt_options1"
[ $VERBOSE -lt 2 ] && VERBOSE=2 [ $VERBOSE -lt 2 ] && VERBOSE=2
@ -788,19 +788,19 @@ dump_command() {
show_reset show_reset
host=$(echo $HOSTNAME | sed 's/\..*$//') host=$(echo $HOSTNAME | sed 's/\..*$//')
$IPTABLES -L $IPT_OPTIONS $IPTABLES -L $g_ipt_options
heading "Log ($LOGFILE)" heading "Log ($LOGFILE)"
packet_log 20 packet_log 20
heading "NAT Table" heading "NAT Table"
$IPTABLES -t nat -L $IPT_OPTIONS $IPTABLES -t nat -L $g_ipt_options
heading "Mangle Table" heading "Mangle Table"
$IPTABLES -t mangle -L $IPT_OPTIONS $IPTABLES -t mangle -L $g_ipt_options
heading "Raw Table" heading "Raw Table"
$IPTABLES -t raw -L $IPT_OPTIONS $IPTABLES -t raw -L $g_ipt_options
local count=$(cat /proc/sys/net/netfilter/nf_conntrack_count) local count=$(cat /proc/sys/net/netfilter/nf_conntrack_count)
local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max) local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max)
@ -986,20 +986,20 @@ heading() {
# #
make_verbose() { make_verbose() {
local v local v
v=$VERBOSE_OFFSET v=$g_verbose_offset
local option local option
option=- option=-
if [ -n "$USE_VERBOSITY" ]; then if [ -n "$g_use_verbosity" ]; then
echo "-v$USE_VERBOSITY" echo "-v$g_use_verbosity"
elif [ $VERBOSE_OFFSET -gt 0 ]; then elif [ $g_verbose_offset -gt 0 ]; then
while [ $v -gt 0 ]; do while [ $v -gt 0 ]; do
option="${option}v" option="${option}v"
v=$(($v - 1)) v=$(($v - 1))
done done
echo $option echo $option
elif [ $VERBOSE_OFFSET -lt 0 ]; then elif [ $g_verbose_offset -lt 0 ]; then
while [ $v -lt 0 ]; do while [ $v -lt 0 ]; do
option="${option}q" option="${option}q"
v=$(($v + 1)) v=$(($v + 1))

View File

@ -62,7 +62,7 @@ get_config() {
ensure_config_path ensure_config_path
if [ -z "$EXPORT" -a "$(id -u)" = 0 ]; then if [ -z "$g_export" -a "$(id -u)" = 0 ]; then
# #
# This block is avoided for compile for export and when the user isn't root # This block is avoided for compile for export and when the user isn't root
# #
@ -259,7 +259,7 @@ get_config() {
;; ;;
esac esac
[ -n "$USE_VERBOSITY" ] && VERBOSE=$USE_VERBOSITY || VERBOSE=$(($VERBOSE_OFFSET + $VERBOSITY)) [ -n "$g_use_verbosity" ] && VERBOSE=$g_use_verbosity || VERBOSE=$(($g_verbose_offset + $VERBOSITY))
if [ $VERBOSE -lt -1 ]; then if [ $VERBOSE -lt -1 ]; then
VERBOSE=-1 VERBOSE=-1
@ -288,20 +288,6 @@ get_config() {
;; ;;
esac esac
case $FAST_STOP in
Yes|yes)
;;
No|no)
FAST_STOP=
;;
*)
if [ -n "$FAST_STOP" ]; then
echo " ERROR: Invalid FAST_STOP setting ($FAST_STOP)" >&2
exit 2
fi
;;
esac
case $AUTOMAKE in case $AUTOMAKE in
Yes|yes) Yes|yes)
;; ;;
@ -360,8 +346,8 @@ compiler() {
esac esac
debugflags="-w" debugflags="-w"
[ -n "$DEBUG" ] && debugflags='-wd' [ -n "$g_debug" ] && debugflags='-wd'
[ -n "$PROFILE" ] && debugflags='-wd:DProf' [ -n "$g_profile" ] && debugflags='-wd:DProf'
# Perl compiler only takes the output file as a argument # Perl compiler only takes the output file as a argument
@ -372,13 +358,13 @@ compiler() {
options="--verbose=$VERBOSE" options="--verbose=$VERBOSE"
[ -n "$STARTUP_LOG" ] && options="$options --log=$STARTUP_LOG" [ -n "$STARTUP_LOG" ] && options="$options --log=$STARTUP_LOG"
[ -n "$LOG_VERBOSITY" ] && options="$options --log_verbosity=$LOG_VERBOSITY"; [ -n "$LOG_VERBOSITY" ] && options="$options --log_verbosity=$LOG_VERBOSITY";
[ -n "$EXPORT" ] && options="$options --export" [ -n "$g_export" ] && options="$options --export"
[ -n "$SHOREWALL_DIR" ] && options="$options --directory=$SHOREWALL_DIR" [ -n "$SHOREWALL_DIR" ] && options="$options --directory=$SHOREWALL_DIR"
[ -n "$TIMESTAMP" ] && options="$options --timestamp" [ -n "$TIMESTAMP" ] && options="$options --timestamp"
[ -n "$TEST" ] && options="$options --test" [ -n "$g_test" ] && options="$options --test"
[ -n "$PREVIEW" ] && options="$options --preview" [ -n "$PREVIEW" ] && options="$options --preview"
[ "$debugging" = trace ] && options="$options --debug" [ "$debugging" = trace ] && options="$options --debug"
[ -n "$REFRESHCHAINS" ] && options="$options --refresh=$REFRESHCHAINS" [ -n "$g_refreshchains" ] && options="$options --refresh=$g_refreshchains"
# #
# Run the appropriate params file # Run the appropriate params file
# #
@ -443,11 +429,11 @@ start_command() {
option= option=
;; ;;
d*) d*)
DEBUG=Yes g_debug=Yes
option=${option#d} option=${option#d}
;; ;;
f*) f*)
FAST=Yes g_fast=Yes
option=${option#f} option=${option#f}
;; ;;
p*) p*)
@ -472,7 +458,7 @@ start_command() {
0) 0)
;; ;;
1) 1)
[ -n "$SHOREWALL_DIR" -o -n "$FAST" ] && usage 2 [ -n "$SHOREWALL_DIR" -o -n "$g_fast" ] && usage 2
if [ ! -d $1 ]; then if [ ! -d $1 ]; then
if [ -e $1 ]; then if [ -e $1 ]; then
@ -494,14 +480,14 @@ start_command() {
export NOROUTES export NOROUTES
export PURGE export PURGE
if [ -n "${FAST}${AUTOMAKE}" ]; then if [ -n "${g_fast}${AUTOMAKE}" ]; then
if qt mywhich make; then if qt mywhich make; then
# #
# RESTOREFILE is exported by get_config() # RESTOREFILE is exported by get_config()
# #
restorefile=$RESTOREFILE restorefile=$RESTOREFILE
if [ -z "$FAST" ]; then if [ -z "$g_fast" ]; then
# #
# Automake -- use the last compiled script # Automake -- use the last compiled script
# #
@ -509,17 +495,17 @@ start_command() {
fi fi
if ! make -qf ${CONFDIR}/Makefile; then if ! make -qf ${CONFDIR}/Makefile; then
FAST= g_fast=
AUTOMAKE= AUTOMAKE=
fi fi
RESTOREFILE=$restorefile RESTOREFILE=$restorefile
else else
FAST= g_fast=
AUTOMAKE= AUTOMAKE=
fi fi
if [ -n "$FAST" ]; then if [ -n "$g_fast" ]; then
RESTOREPATH=${VARDIR}/$RESTOREFILE RESTOREPATH=${VARDIR}/$RESTOREFILE
if [ -x $RESTOREPATH ]; then if [ -x $RESTOREPATH ]; then
@ -558,19 +544,19 @@ compile_command() {
while [ -n "$option" ]; do while [ -n "$option" ]; do
case $option in case $option in
e*) e*)
EXPORT=Yes g_export=Yes
option=${option#e} option=${option#e}
;; ;;
p*) p*)
PROFILE=Yes g_profile=Yes
option=${option#p} option=${option#p}
;; ;;
t*) t*)
TEST=Yes g_test=Yes
option=${option#t} option=${option#t}
;; ;;
d*) d*)
DEBUG=Yes; g_debug=Yes;
option=${option#d} option=${option#d}
;; ;;
-) -)
@ -619,8 +605,6 @@ compile_command() {
;; ;;
esac esac
export EXPORT
[ "x$file" = x- ] || progress_message3 "Compiling..." [ "x$file" = x- ] || progress_message3 "Compiling..."
compiler $debugging compile $file compiler $debugging compile $file
@ -646,15 +630,15 @@ check_command() {
option= option=
;; ;;
e*) e*)
EXPORT=Yes g_export=Yes
option=${option#e} option=${option#e}
;; ;;
p*) p*)
PROFILE=Yes g_profile=Yes
option=${option#p} option=${option#p}
;; ;;
d*) d*)
DEBUG=Yes; g_debug=Yes;
option=${option#d} option=${option#d}
;; ;;
r*) r*)
@ -696,8 +680,6 @@ check_command() {
;; ;;
esac esac
export EXPORT
progress_message3 "Checking..." progress_message3 "Checking..."
compiler $debugging $nolock check compiler $debugging $nolock check
@ -726,11 +708,11 @@ restart_command() {
option= option=
;; ;;
d*) d*)
DEBUG=Yes g_debug=Yes
option=${option#d} option=${option#d}
;; ;;
f*) f*)
FAST=Yes g_fast=Yes
option=${option#f} option=${option#f}
;; ;;
n*) n*)
@ -770,7 +752,7 @@ restart_command() {
fi fi
SHOREWALL_DIR=$(resolve_file $1) SHOREWALL_DIR=$(resolve_file $1)
[ -n "$FAST" ] && fatal_error "Directory may not be specified with the -f option" [ -n "$g_fast" ] && fatal_error "Directory may not be specified with the -f option"
export SHOREWALL_DIR export SHOREWALL_DIR
AUTOMAKE= AUTOMAKE=
;; ;;
@ -784,19 +766,19 @@ restart_command() {
export NOROUTES export NOROUTES
export PURGE export PURGE
if [ -z "$FAST" -a -n "$AUTOMAKE" ]; then if [ -z "$g_fast" -a -n "$AUTOMAKE" ]; then
if qt mywhich make; then if qt mywhich make; then
# #
# RESTOREFILE is exported by get_config() # RESTOREFILE is exported by get_config()
# #
restorefile=$RESTOREFILE restorefile=$RESTOREFILE
RESTOREFILE=firewall RESTOREFILE=firewall
make -qf ${CONFDIR}/Makefile && FAST=Yes make -qf ${CONFDIR}/Makefile && g_fast=Yes
RESTOREFILE=$restorefile RESTOREFILE=$restorefile
fi fi
fi fi
if [ -z "$FAST" ]; then if [ -z "$g_fast" ]; then
progress_message3 "Compiling..." progress_message3 "Compiling..."
if compiler $debugging $nolock compile ${VARDIR}/.restart; then if compiler $debugging $nolock compile ${VARDIR}/.restart; then
@ -852,11 +834,11 @@ refresh_command() {
done done
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
REFRESHCHAINS=$1 g_refreshchains=$1
shift shift
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
REFRESHCHAINS="$REFRESHCHAINS,$1" g_refreshchains="$g_refreshchains,$1"
shift shift
done done
fi fi
@ -1442,16 +1424,17 @@ if [ $# -gt 0 ] && [ "$1" = "nolock" ]; then
fi fi
SHOREWALL_DIR= SHOREWALL_DIR=
IPT_OPTIONS="-nv"
FAST=
VERBOSE_OFFSET=0
USE_VERBOSITY=
NOROUTES= NOROUTES=
PURGE= PURGE=
DEBUG=
EXPORT=
export TIMESTAMP= export TIMESTAMP=
noroutes=
g_ipt_options="-nv"
g_fast=
g_verbose_offset=0
g_use_verbosity=
g_debug=
g_export=
g_refreshchains=
finished=0 finished=0
@ -1483,43 +1466,43 @@ while [ $finished -eq 0 ]; do
shift shift
;; ;;
e*) e*)
EXPORT=Yes g_export=Yes
option=${option#e} option=${option#e}
;; ;;
x*) x*)
IPT_OPTIONS="-xnv" g_ipt_options="-xnv"
option=${option#x} option=${option#x}
;; ;;
q*) q*)
VERBOSE_OFFSET=$(($VERBOSE_OFFSET - 1 )) g_verbose_offset=$(($g_verbose_offset - 1 ))
option=${option#q} option=${option#q}
;; ;;
f*) f*)
FAST=Yes g_fast=Yes
option=${option#f} option=${option#f}
;; ;;
v*) v*)
option=${option#v} option=${option#v}
case $option in case $option in
-1*) -1*)
USE_VERBOSITY=-1 g_use_verbosity=-1
option=${option#-1} option=${option#-1}
;; ;;
0*) 0*)
USE_VERBOSITY=0 g_use_verbosity=0
option=${option#0} option=${option#0}
;; ;;
1*) 1*)
USE_VERBOSITY=1 g_use_verbosity=1
option=${option#1} option=${option#1}
;; ;;
2*) 2*)
USE_VERBOSITY=2 g_use_verbosity=2
option=${option#2} option=${option#2}
;; ;;
*) *)
VERBOSE_OFFSET=$(($VERBOSE_OFFSET + 1 )) g_verbose_offset=$(($g_verbose_offset + 1 ))
USE_VERBOSITY= g_use_verbosity=
;; ;;
esac esac
;; ;;
@ -1613,7 +1596,6 @@ fi
FIREWALL=${VARDIR}/firewall FIREWALL=${VARDIR}/firewall
LIBRARIES="$SHAREDIR/lib.base $SHAREDIR/lib.cli" LIBRARIES="$SHAREDIR/lib.base $SHAREDIR/lib.cli"
VERSION_FILE=$SHAREDIR/version VERSION_FILE=$SHAREDIR/version
REFRESHCHAINS=
RECOVERING= RECOVERING=
export RECOVERING export RECOVERING