# lp interface for MP242 (Brother 1709 Dot Matrix Printer)
# and MP245 (Brother HR-40 Daisy Wheel Printer) Serial Port 
#

x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
stty 9600 ixon ixoff -ixany clocal onlcr opost<&1
echo "\014\c"
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: `basename $0`\n"
date
echo "\n"
if [ -n "$3" ]
then
	banner $3
fi
bname=$0
reqid=$1
usrid=$2
title=$3
copies=$4
echo "\014\c"
shift; shift; shift; shift; shift
files="$*"
i=1
while [ $i -le $copies ]
do
	for file in $files
	do
		cat "$file" 2>&1
		echo "\014\c"
	done
	i=`expr $i + 1`
done
sleep 10
exit $?
