Implement -p option to disable PAGER

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2016-11-17 10:58:10 -08:00
parent ab9f340c55
commit 9eb390403b
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10
2 changed files with 42 additions and 28 deletions

View File

@ -1161,7 +1161,11 @@ show_macros() {
done
}
show_a_macro() {
echo "Shorewall $SHOREWALL_VERSION Macro $1 at $g_hostname - $(date)"
cat ${directory}/macro.$1
}
#
# Show Command Executor
#
@ -3992,24 +3996,26 @@ get_config() {
g_loopback=$(find_loopback_interfaces)
[ -n "$PAGER" ] || PAGER=$DEFAULT_PAGER
if [ -z "$g_nopager" ]; then
[ -n "$PAGER" ] || PAGER=$DEFAULT_PAGER
if [ -n "$PAGER" -a -t 1 ]; then
case $PAGER in
/*)
g_pager="$PAGER"
[ -f "$g_pager" ] || fatal_error "PAGER=$PAGER does not exist"
;;
*)
g_pager=$(mywhich $PAGER 2> /dev/null)
[ -n "$g_pager" ] || fatal_error "PAGER=$PAGER does not exist"
;;
esac
if [ -n "$PAGER" -a -t 1 ]; then
case $PAGER in
/*)
g_pager="$PAGER"
[ -f "$g_pager" ] || fatal_error "PAGER=$PAGER does not exist"
;;
*)
g_pager=$(mywhich $PAGER 2> /dev/null)
[ -n "$g_pager" ] || fatal_error "PAGER=$PAGER does not exist"
;;
esac
[ -x "$g_pager" ] || fatal_error "PAGER $g_pager is not executable"
[ -x "$g_pager" ] || fatal_error "PAGER $g_pager is not executable"
g_pager="| $g_pager"
fi
g_pager="| $g_pager"
fi
fi
if [ -n "$DYNAMIC_BLACKLIST" ]; then
setup_dbl
@ -4357,6 +4363,7 @@ shorewall_cli() {
g_loopback=
g_compiled=
g_pager=
g_nopager=
g_blacklistipset=
g_disconnect=
@ -4453,6 +4460,11 @@ shorewall_cli() {
g_timestamp=Yes
option=${option#t}
;;
p*)
g_nopager=Yes
option=${option#p}
;;
-)
finished=1
option=

View File

@ -318,21 +318,23 @@ get_config() {
[ -n "$PAGER" ] || PAGER=$DEFAULT_PAGER
if [ -n "$PAGER" -a -t 1 ]; then
case $PAGER in
/*)
g_pager="$PAGER"
[ -f "$g_pager" ] || fatal_error "PAGER $PAGER does not exist"
;;
*)
g_pager=$(mywhich $PAGER 2> /dev/null)
[ -n "$g_pager" ] || fatal_error "PAGER $PAGER not found"
;;
esac
if [ -z "$g_nopager" ]; then
if [ -n "$PAGER" -a -t 1 ]; then
case $PAGER in
/*)
g_pager="$PAGER"
[ -f "$g_pager" ] || fatal_error "PAGER $PAGER does not exist"
;;
*)
g_pager=$(mywhich $PAGER 2> /dev/null)
[ -n "$g_pager" ] || fatal_error "PAGER $PAGER not found"
;;
esac
[ -x "$g_pager" ] || fatal_error "PAGER $g_pager is not executable"
[ -x "$g_pager" ] || fatal_error "PAGER $g_pager is not executable"
g_pager="| $g_pager"
g_pager="| $g_pager"
fi
fi
if [ -n "$DYNAMIC_BLACKLIST" ]; then