Only envoke 'clear' when STDOUT is a terminal

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@1967 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2005-02-23 18:11:45 +00:00
parent 09e6003f0c
commit 3f6514a11f
3 changed files with 31 additions and 17 deletions

View File

@ -5,6 +5,9 @@ Changes in 2.2.2
2) Enhanced support in the SOURCE column of /etc/shorewall/tcrules.
3) All calls to 'clear' are now conditional on the output device being
a terminal.
Changes in 2.2.1
1) Add examples to the zones and policy files.

View File

@ -9,9 +9,13 @@ Problems corrected in version 2.2.2
-----------------------------------------------------------------------
New Features in version 2.2.2
1) The SOURCE column in the /etc/shorewall/tcrules now allows $FW to
be optionally followed by ":" and a host/network address or address
range.
1) The SOURCE column in the /etc/shorewall/tcrules file now allows $FW
to be optionally followed by ":" and a host/network address or
address range.
2) Shorewall now clears the output device only if it is a
terminal. This avoids ugly control sequences being placed in files
when /sbin/shorewall output is redirected.
-----------------------------------------------------------------------
Problems corrected in version 2.2.1

View File

@ -220,6 +220,13 @@ get_config() {
}
#
# Clear descriptor 1 if it is a terminal
#
clear_term() {
[ -t 1 ] && clear
}
#
# Display IPTABLES rules -- we used to store them in a variable but ash
# dies when trying to display large sets of rules
@ -238,7 +245,7 @@ display_chains()
$IPTABLES -L $IPT_OPTIONS >> $TMPFILE
clear
clear_term
echo "$banner $(date)"
echo
echo "Standard Chains"
@ -250,7 +257,7 @@ display_chains()
timed_read
clear
clear_term
echo "$banner $(date)"
echo
firstchain=Yes
@ -268,7 +275,7 @@ display_chains()
for zone in $zones; do
if [ -n "$(grep "^Chain \.*${zone}" $TMPFILE)" ] ; then
clear
clear_term
echo "$banner $(date)"
echo
firstchain=Yes
@ -287,7 +294,7 @@ display_chains()
fi
done
clear
clear_term
echo "$banner $(date)"
echo
firstchain=Yes
@ -308,7 +315,7 @@ display_chains()
timed_read
clear
clear_term
echo "$banner $(date)"
echo
firstchain=Yes
@ -443,7 +450,7 @@ monitor_firewall() # $1 = timeout -- if negative, prompt each time that
while true; do
display_chains
clear
clear_term
echo "$banner $(date)"
echo
@ -474,7 +481,7 @@ monitor_firewall() # $1 = timeout -- if negative, prompt each time that
timed_read
fi
clear
clear_term
echo "$banner $(date)"
echo
echo "NAT Status"
@ -482,7 +489,7 @@ monitor_firewall() # $1 = timeout -- if negative, prompt each time that
$IPTABLES -t nat -L $IPT_OPTIONS
timed_read
clear
clear_term
echo "$banner $(date)"
echo
echo
@ -491,7 +498,7 @@ monitor_firewall() # $1 = timeout -- if negative, prompt each time that
$IPTABLES -t mangle -L $IPT_OPTIONS
timed_read
clear
clear_term
echo "$banner $(date)"
echo
echo
@ -500,7 +507,7 @@ monitor_firewall() # $1 = timeout -- if negative, prompt each time that
cat /proc/net/ip_conntrack
timed_read
clear
clear_term
echo "$banner $(date)"
echo
echo
@ -509,7 +516,7 @@ monitor_firewall() # $1 = timeout -- if negative, prompt each time that
show_tc
timed_read
clear
clear_term
echo "$banner $(date)"
echo
echo
@ -541,7 +548,7 @@ logwatch() # $1 = timeout -- if negative, prompt each time that
qt which awk && haveawk=Yes || haveawk=
while true; do
clear
clear_term
echo "$banner $(date)"
echo
@ -960,7 +967,7 @@ case "$1" in
status)
[ -n "$debugging" ] && set -x
[ $# -eq 1 ] || usage 1
clear
clear_term
echo "Shorewall-$version Status at $HOSTNAME - $(date)"
echo
show_reset
@ -1029,7 +1036,7 @@ case "$1" in
hits)
[ -n "$debugging" ] && set -x
[ $# -eq 1 ] || usage 1
clear
clear_term
echo "Shorewall-$version Hits at $HOSTNAME - $(date)"
echo