#
# getlbl:
#	Prompt for label printer name, with default
#	Written by Leor Zolman, 9/91
#
# Usage:
#	getlbl 
#	Returns the appropriate lp options on standard output.
#
# Background:
#	There are only two label printers present in this installation,
#	one in the Marketing Dept. (mktg) and one in Internal Services (is).
#	So, by default, anyone in the mktg (or per) departments get the mktg
#	label printer, and everyone else gets the is label printer.

PTRDIR=/u/leor/docs/Cols/SA/Printers			# Printer control directory
CODECHAR=B
WHAT="Label-Printer"

[ $# -gt 1 ] && echo "Usage: $0 [default-$WHAT]" >&2 && exit

. $PTRDIR/initmap.sh		# initialize and handle special-case mappings

defarea=`sed -n 's/^'$DEPT',.*\([A-Z]\)$/\1/p' dept.map`
[ $DEBUG = Y ] && echo "defarea = $defarea"

#
# choose printer region:
#

while true
do
	echo "\n   Label Printer Areas:" >&2
	sed -n 's/^.*"\(.\)\(.*\)".*$/\1\2  (\1)/p' dept.map
	while true
	do
		echo "\nSelect an area (by single-letter code) [$defarea]: \c">&2
		read area
		[ "$area" = "" ] && area=$defarea
		area=`echo "$area\c" | tr '[a-z]' '[A-Z]'`
		if tmp=`grep $area'$' dept.map`
		then
			DEPT=`echo $tmp | cut -d, -f2 | tr -d " "`
			break
		fi
	done								
	[ $DEBUG = Y ] && echo "after dept loop, DEPT = $DEPT"
	. $PTRDIR/initmap.sh l			# force label paper type
	break
done

. $PTRDIR/proxmap.sh
echo $lpopts

exit 0
