Cover V05, I01
Article
Listing 1
Listing 2
Listing 3
Listing 4
Listing 5
Listing 6

jan96.tar


Listing 6: A sample interface for dumb line printer having no banner pages and no form feeds

:
#

#Set up some global variables.
: ${SPOOLDIR:=/usr/spool/lp}
: ${LOCALPATH:=${SPOOLDIR}/bin}

#Set up the default filter.
if [  -x "${LOCALPATH}/lp.cat" ]
then
LPCAT="${LOCALPATH}/lp.cat 0"
else
LPCAT="cat"
fi

#If we are not using a filter, use the default one.
if [ -z "${FILTER}" ]
then
FILTER="${LPCAT}"
fi

if [ -x "${LOCALPATH}/drain.output" ]
then
DRAIN="${LOCALPATH}/drain.output 1"
else
DRAIN=
fi

nobanner="no"

for i in $5
do
case "${i}" in

nobanner )
nobanner="yes"
;;
esac
done

copies=$4
shift; shift; shift; shift; shift
files="$*"
i=1
while [ $i -le $copies ]
do
for file in $files
do
0<${file} eval ${FILTER} 2>&1
done
i=`expr $i + 1`
done

#Draining characters might be necessary.
${DRAIN}

exit 0