#! /bin/csh -f
#
#-	print -  print file(s) to line printer (with sf interface)
#-
#	Author:		Paul Lew, General Systems Group, Salem, NH
#	Created at:	5/8/86
#	Last update:	01/27/88  00:03 AM  (Edition: 11)
#
#-	Usage:	Print filenames <CR>
#---------------------------------------------------------------#
#	      Display help if requested by user			#
#---------------------------------------------------------------#
switch ( "$1" )
	case -H[xX]:
		set echo; set verbose; shift
		breaksw
	case -H*:
		show_help `which $0` $1
		goto end
	default:
	endsw
#---------------------------------------------------------------#
#	  Display form to take input from the user		#
#---------------------------------------------------------------#
set srcfile = "/tmp/form.$$"
sf -o ${srcfile} -u <<!

	     General Systems Group Fast Printer Spooler

   File Name: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

	[-#] Number of copies:	~~~	      [-h] Burst Header Page: ~~~
	[-m] Send mail on completion: ~~~     [-p] Format with pr:    ~~~

	[-J] Job Name:		~~~~~~~~~~~~~
	[-C] Class Name:	~~~~~~~~~~~~~
	[-T] Title for pr:	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

		    Current Print Queue Status
`lpq | head -5`

	[Press TAB to move to next field, RETURN to execute]

v=fnd=$*
v=copya=add=1v=bursts=/Yes/Noa=a
v=mails=/No/Yesa=av=prs=/Yes/Noa=a
v=jobd=$1
v=classd=`hostname`
v=titled=$1
!
#---------------------------------------------------------------#
#	Execute script to set variables from form		#
#---------------------------------------------------------------#
if ( ! -e ${srcfile} ) goto end
source ${srcfile}
#---------------------------------------------------------------#
#	  Re-arrange variables before execution			#
#---------------------------------------------------------------#
if ( "${copy}" != "1" ) then
	set copy = "-#${copy}"
else
	set copy = ''
	endif
#
if ( "${burst}" != "Yes" ) then
	set burst = "-h"
else
	set burst = ''
	endif
#
if ( "${pr}" == "Yes" ) then
	set pr = "-p"
else
	set pr = ''
	endif
#
if ( "${mail}" == "Yes" ) then
	set mail = "-m"
else
	set mail = ''
	endif
#
set tf; set cf; set jf
if ( "${title}" != "" ) set tf = "-T"
if ( "${class}" != "" ) set cf = "-C"
if ( "${job}" != "" ) set jf = "-J"
#---------------------------------------------------------------#
#		   Execute proper command ....			#
#---------------------------------------------------------------#
if ( "${fn}" != "" ) then
	lpr ${copy} ${burst} ${pr} ${mail} ${tf} "${title}" \
	${cf} "${class}" ${jf} "${job}" ${fn}
	endif
/bin/rm -f ${srcfile}
end:
