Eliminate some of the all-caps variable name restrictions

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2010-02-22 08:23:17 -08:00
parent 55c9cf3e99
commit 20ca22d437
2 changed files with 76 additions and 81 deletions

View File

@ -132,7 +132,7 @@ syslog_circular_buffer() {
# #
packet_log() # $1 = number of messages packet_log() # $1 = number of messages
{ {
if [ -n "$SHOWMACS" -o $VERBOSE -gt 2 ]; then if [ -n "$g_showmacs" -o $VERBOSE -gt 2 ]; then
$LOGREAD | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/ $LOGREAD | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/
else else
$LOGREAD | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/ $LOGREAD | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/
@ -375,15 +375,15 @@ 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*)
SHOWMACS=Yes g_showmacs=Yes
option=${option#m} option=${option#m}
;; ;;
f*) f*)
FILEMODE=Yes g_filemode=Yes
option=${option#f} option=${option#f}
;; ;;
t) t)
@ -403,7 +403,7 @@ show_command() {
shift shift
;; ;;
l*) l*)
IPT_OPTIONS1="--line-numbers" g_ipt_options1="--line-numbers"
option=${option#l} option=${option#l}
;; ;;
*) *)
@ -419,7 +419,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
@ -436,14 +436,14 @@ show_command() {
echo "$PRODUCT $version Mangle Table at $HOSTNAME - $(date)" echo "$PRODUCT $version Mangle Table at $HOSTNAME - $(date)"
echo echo
show_reset show_reset
$IP6TABLES -t mangle -L $IPT_OPTIONS $IP6TABLES -t mangle -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
$IP6TABLES -t raw -L $IPT_OPTIONS $IP6TABLES -t raw -L $g_ipt_options
;; ;;
log) log)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
@ -493,7 +493,7 @@ show_command() {
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
determine_capabilities determine_capabilities
VERBOSE=2 VERBOSE=2
if [ -n "$FILEMODE" ]; then if [ -n "$g_filemode" ]; then
report_capabilities1 report_capabilities1
else else
report_capabilities report_capabilities
@ -523,10 +523,10 @@ show_command() {
show_reset show_reset
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
for chain in $*; do for chain in $*; do
$IP6TABLES -t $table -L $chain $IPT_OPTIONS $IP6TABLES -t $table -L $chain $g_ipt_options
done done
else else
$IP6TABLES -t $table -L $IPT_OPTIONS $IP6TABLES -t $table -L $g_ipt_options
fi fi
;; ;;
vardir) vardir)
@ -586,7 +586,7 @@ show_command() {
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
[ -n "$table_given" ] || for chain in $*; do [ -n "$table_given" ] || for chain in $*; do
if ! qt $IP6TABLES -t $table -L $chain $IPT_OPTIONS; then if ! qt $IP6TABLES -t $table -L $chain $g_ipt_options; then
error_message "ERROR: Chain '$chain' is not recognized by $IP6TABLES." error_message "ERROR: Chain '$chain' is not recognized by $IP6TABLES."
exit 1 exit 1
fi fi
@ -596,13 +596,13 @@ show_command() {
echo echo
show_reset show_reset
for chain in $*; do for chain in $*; do
$IP6TABLES -t $table -L $chain $IPT_OPTIONS $IP6TABLES -t $table -L $chain $g_ipt_options
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
$IP6TABLES -t $table -L $IPT_OPTIONS $IP6TABLES -t $table -L $g_ipt_options
fi fi
;; ;;
esac esac
@ -628,15 +628,15 @@ dump_command() {
option= option=
;; ;;
x*) x*)
IPT_OPTIONS="-xnv" g_ipt_options="-xnv"
option=${option#x} option=${option#x}
;; ;;
m*) m*)
SHOWMACS=Yes g_showmacs=Yes
option=${option#m} option=${option#m}
;; ;;
l*) l*)
IPT_OPTIONS1="--line-numbers" g_ipt_options1="--line-numbers"
option=${option#l} option=${option#l}
;; ;;
*) *)
@ -652,7 +652,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
@ -669,16 +669,16 @@ dump_command() {
show_reset show_reset
host=$(echo $HOSTNAME | sed 's/\..*$//') host=$(echo $HOSTNAME | sed 's/\..*$//')
$IP6TABLES -L $IPT_OPTIONS $IP6TABLES -L $g_ipt_options
heading "Log ($LOGFILE)" heading "Log ($LOGFILE)"
packet_log 20 packet_log 20
heading "Mangle Table" heading "Mangle Table"
$IP6TABLES -t mangle -L $IPT_OPTIONS $IP6TABLES -t mangle -L $g_ipt_options
heading "Raw Table" heading "Raw Table"
$IP6TABLES -t raw -L $IPT_OPTIONS $IP6TABLES -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)
@ -869,20 +869,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))
@ -1096,7 +1096,7 @@ logwatch_command() {
option=${option#q} option=${option#q}
;; ;;
m*) m*)
SHOWMACS=Yes g_showmacs=Yes
option=${option#m} option=${option#m}
;; ;;
-) -)

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
# #
@ -178,7 +178,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
@ -262,7 +262,6 @@ compiler() {
# #
ensure_config_path ensure_config_path
compiler=perl
haveparams= haveparams=
case $COMMAND in case $COMMAND in
@ -277,8 +276,8 @@ compiler() {
[ $command = exec ] || command= [ $command = exec ] || command=
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
@ -289,13 +288,13 @@ compiler() {
options="--verbose=$VERBOSE --family=6" options="--verbose=$VERBOSE --family=6"
[ -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 "$g_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"
[ -x $pc ] || startup_error "Shorewall6 requires the shorewall package which is not installed" [ -x $pc ] || startup_error "Shorewall6 requires the shorewall package which is not installed"
# #
# Run the appropriate params file # Run the appropriate params file
@ -363,11 +362,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}
;; ;;
*) *)
@ -387,7 +386,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
@ -409,13 +408,13 @@ 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=$RESTOREFILE restorefile=$RESTOREFILE
# #
# RESTOREFILE is exported by get_config() # RESTOREFILE is exported by get_config()
# #
if [ -z "$FAST" ]; then if [ -z "$g_fast" ]; then
# #
# Autofast -- use the last compiled script # Autofast -- use the last compiled script
# #
@ -423,17 +422,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
@ -472,19 +471,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}
;; ;;
-) -)
@ -533,8 +532,6 @@ compile_command() {
;; ;;
esac esac
export EXPORT
[ "x$file" = x- ] || progress_message3 "Compiling..." [ "x$file" = x- ] || progress_message3 "Compiling..."
compiler exec $debugging compile $file compiler exec $debugging compile $file
@ -560,19 +557,19 @@ 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}
;; ;;
r*) r*)
PREVIEW=Yes; g_preview=Yes;
option=${option#r} option=${option#r}
;; ;;
d*) d*)
DEBUG=Yes; g_debug=Yes;
option=${option#d} option=${option#d}
;; ;;
*) *)
@ -610,8 +607,6 @@ check_command() {
;; ;;
esac esac
export EXPORT
progress_message3 "Checking..." progress_message3 "Checking..."
compiler exec $debugging $nolock check compiler exec $debugging $nolock check
@ -640,11 +635,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*)
@ -684,7 +679,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=
;; ;;
@ -698,19 +693,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 run $debugging $nolock compile ${VARDIR}/.restart; then if compiler run $debugging $nolock compile ${VARDIR}/.restart; then
@ -766,11 +761,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
@ -1338,16 +1333,16 @@ if [ $# -gt 0 ] && [ "$1" = "nolock" ]; then
fi fi
SHOREWALL_DIR= SHOREWALL_DIR=
IPT_OPTIONS="-nv" g_ipt_options="-nv"
FAST= g_fast=
VERBOSE_OFFSET=0 g_verbose_offset=0
USE_VERBOSITY= g_use_verbosity=
g_debug=
g_export=
NOROUTES= NOROUTES=
PURGE= PURGE=
DEBUG=
EXPORT=
export TIMESTAMP= export TIMESTAMP=
noroutes=
finished=0 finished=0
@ -1379,43 +1374,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
;; ;;