#!/bin/sh # # fwprint - November 14, 1998 # Modified for fwprint-6.0.1 # # This shell script is a wrapper program for fwrules, # in hopes it makes using the printing facilities # that are required a little easier # # Changes # - Feb 27 1998 # Fixed some stupid path problems # - March 12, 1998 # Fixed some font/landscape problems # - May 02, 1998 # Added objects support # Fixed font problems with -r FWRULES=`which fwrules` if [ $? -eq 1 ] ; then echo "Cannot find 'fwrules' program. Check your " echo "path and try again" exit 1 fi if [ ! -x $FWRULES ] ; then echo "Cannot execute 'fwrules' program. Check your" echo "path and permissions and try again" exit 1 fi if [ $# -eq 0 ] ; then $FWRULES -h exit 1 fi # set default font font=10 # default to not printing landscape landscape="" # default to printing output printing=1 # Continue until we have parsed all the command-line options, # or we find one that is not supposed to be printed for i in "$@" ; do if [ "$i" = "-h" ] ; then $FWRULES -h exit fi if [ "$i" = "-p" ] ; then printing=0; fi if [ "$i" = "-n" ] ; then if [ ! "$services" -eq 1 ] ; then printing=0 fi fi if [ "$i" = "-o" ] ; then landscape="-r" font=7.9 fi if [ "$i" = "-a" ] ; then font=7 landscape="-r" fi if [ "$i" = "-r" ] ; then landscape="-r" font=10 fi if [ "$i" = "-g" ] ; then printing=0 fi if [ "$i" = "-x" ] ; then printing=0 fi # if user prints services, we assume it will # be all rules matching a specific service, and # if not, it will be okay to print small font anyway. if [ "$i" = "-s" ] ; then font=7.9 landscape= services=1 fi done # If $printing still equals 1, then print it as postscript # to stdout if [ $printing -eq 1 ] ; then $FWRULES $* | \ enscript $landscape --pretty-print=simple_highlight \ --header="|Firewall Rules|Confidential" -F Courier@18 \ -G -f Courier@$font -p- else $FWRULES $* | sed -e 's/\//g' -e 's/\<\/b\>//g' fi