
# Alpha Microsystems IDS P80/P132 printer interface (black ribbon)
# Copyright (C) 1983 By Alpha Microsystems, Irvine CA.
#

stty 9600 cread ixon ixany -raw opost -parenb cs8 tabs 0<&1
bname=$0
reqid=$1
usrid=$2
title=$3
hdr=
if [ -n "$title" ]
then
	hdr=-h
fi
copies=$4
page=
comp=
draft=d
width=-l80
for i in $5
do
	case "$i" in
		c | -c)		# compressed print
		comp=c
		;;
		w132 | -w132)	# paper width
		width=-l132
		;;
		p | -p)		# paginate printout
		page=p
		;;
		nlq | -nlq)	# near letter quality
		draft=nlq
		;;
	esac
done
shift; shift; shift; shift; shift
files="$*"
echo "\035\02\06\033R,2,\$\c"
if [ X$comp = Xc ]
then
	echo "\037\033F,57,114,171,228,286,343,400,457,514,571,629,686,743,800,857,914,971,1029,1086,1143,1200,\$\c"
else
	echo "\033F,96,192,288,384,480,576,672,768,864,960,1056,1152,1248,1344,1440,1536,\$\c"
fi
if [ X$width = X-l80 ]
then
	echo "\033J,0,959,\$\c"
	x="*******************************************************************************"
else
	echo "\033J,0,1583,\$\c"
	x="***********************************************************************************************************************************"
fi
if [ X$draft = Xnlq ]
then
	echo "\033R,1,\$\c"
fi
i=1
while [ $i -le $copies ]
do
	for file in $files
	do
		echo "\033Q,5,\$$x\n$x\n$x\n"
		banner "$usrid"
		echo "\n\c"
		echo "Filename: $file\n"
		user= `grep "^$usrid:" /etc/passwd | line | cut -d: -f5`
		if [ -n "$user" ]
		then
			echo "User: $user\n"
		fi
		echo "Request id: $reqid	Printer: `basename $bname`\n"
		date
		echo "\n\c"
		if [ -n "$title" ]
		then
			banner "$title"
		else
			banner `basename $file`
		fi
		echo "\014\c"
		if [ X$page = Xp ]
		then
			newform -i $width "$file" | pr -r $hdr "$title" 2>&1
		else
			cat "$file" 2>&1
			echo "\014\c"
		fi
	done
	i=`expr $i + 1`
done
echo "\014\c"
sleep 20
exit 0

