:
#	@(#) crnlmap 22.1 89/09/25 
#
#	Copyright (C) The Santa Cruz Operation, 1985, 1986, 1987, 1988, 1989.
#	This Module contains Proprietary Information of
#	The Santa Cruz Operation, and should be treated as Confidential.
#
#!	Serial or parallel printer requiring <nl> mapped to <cr><lf>
#
printer=`basename $0`
request=$1
name=$2
title=$3
copies=$4
options=$5
shift; shift; shift; shift; shift

# If it is necessary to change the baud rate or other stty settings for
# your serial printer add the appropriate options here:
stty onlcr opost 0<&1

# border around the banner
x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

# the fifth field of the /etc/passwd file is assigned to the variable user
user=`sed -n "s/^$name:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd`

# nhead gets the value of BANNERS or 1 by default
nhead=`sed -n 's/^BANNERS=//p' /etc/default/lpd`
[ "$nhead" -ge 0 -a "$nhead" -le 5 ] || nhead=1

# print the banner $nhead times
{
while	[ "$nhead" -gt 0 ]
do
	echo "$x\n"
	banner "$name"
	echo "$x\n"
	[ "$user" ] && echo "User: $user\n"
	echo "Request id: $request\n"
	echo "Printer: $printer\n"
	date
	echo
	[ "$title" ] && banner $title
	echo "\f\c"
	nhead=`expr $nhead - 1`
done

# send the file(s) to the standard out $copies times
while	[ "$copies" -gt 0 ]
do
	for file
	do
		cat "$file" 2>&1
		echo "\f\c"
	done
	copies=`expr $copies - 1`
done
} 
exit 0
