home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume20
/
epf
/
part01
/
epson
< prev
next >
Wrap
Text File
|
1989-10-24
|
3KB
|
140 lines
# iPAX286 lp interface for dumb parallel line printer
# configured for Epson LQ-800
# and enough options to handle tbl|eqn|nroff output
#
#ident "@(#) 1.2"
#
#
DEFAULT="\033@" #printer configuration strings
UNION="\033U\001"
UNIOFF="\033U\000"
DRAFT="\033x\000"
NLQ="\033x\001"
PICA="\033P"
ELITE="\033M"
TRON="/usr/local/bin/lptoggle 1" #reconfigure printer port
TROFF="/usr/local/bin/lptoggle 0" #restore printer port to defaults
NTOEPS="| /usr/local/bin/nroff.to.epson"
RESET="" #load with printer control strings to restore
#printer defaults
LPRESET="" #set to $TROFF if need to restore printer port
FILTER="-v" #default to remove ctrl chars - else may pass thru
#unwanted printer control codes
#set to $NTOEPS for printing of nroff output
x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
#use lp -o<options> in $5 to setup and restore the printer;
#probably there should be a man page or usage message, even though the
#option list is pretty obvious and mnemonic.
echo $5|egrep 'nroff|filter' >/dev/null
if [ $? -eq 0 ]
then
FILTER="$NTOEPS"
fi
echo $5|egrep 'epson|nofilter' >/dev/null
if [ $? -eq 0 ]
then
FILTER=""
fi
echo $5|egrep 'nroff|setlp|lpset|tron' >/dev/null
if [ $? -eq 0 ]
then
LPRESET="$TROFF"
fi
echo $5|egrep 'nroff|lq|resetdraft' >/dev/null
if [ $? -eq 0 ]
then
RESET="$DRAFT$RESET"
fi
echo $5|egrep 'nroff|12|elite|resetpica' >/dev/null
if [ $? -eq 0 ]
then
RESET="$PICA$RESET"
fi
echo $5|egrep 'resetall|resetdefault' >/dev/null
if [ $? -eq 0 ]
then
RESET="$DEFAULT$RESET"
fi
echo $5|egrep 'uni[^ ]*on|resetuni' >/dev/null
if [ $? -eq 0 ]
then
RESET="$UNIOFF$RESET"
fi
for i in $5
do
case $i in
nroff|setlp|lpset|tron)
eval $TRON ;;
troff)
eval $TROFF ;;
uni*off)
echo "$UNIOFF" ;;
uni*on)
echo "$UNION" ;;
nlq|lq)
echo "$NLQ" ;;
draft)
echo "$DRAFT" ;;
10|pica)
echo "$PICA" ;;
12|elite)
echo "$ELITE" ;;
default)
echo "$DEFAULT"
eval $TROFF ;;
filter|epson|nofilter|reset*)
;;
*)
echo bad option;exit 1 ;;
esac
done
printer=`basename $0`
copies=$4
if [ X${BANNER:+yes} = Xyes ]
then
echo "$x\n$x\n$x\n$x\n"
banner "$2"
echo "\n"
user=`grep "^$2:" /etc/passwd | line | cut -d: -f5`
if [ -n "$user" ]
then
echo "User: $user\n"
else
echo "\n"
fi
echo "Request id: $1 Printer: $printer\n"
date
echo "\n"
if [ -n "$3" ]
then
banner $3
fi
echo "Print Options: \n"
echo " Copies="$copies"\n"
echo "\014\c"
fi
shift; shift; shift; shift; shift
files="$*"
i=1
while [ $i -le $copies ]
do
for file in $files
do
eval cat $FILTER "$file" 2>&1
echo "\014\c"
done
i=`expr $i + 1`
done
echo "$x\n$x\n$x\n$x\n"
echo "\014\c"
echo "${RESET}\c"
eval ${LPRESET}
exit 0