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

View File

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