From: bill@Celestial.COM (Bill Campbell)
Subject: Re: BSD line printer daemon on SCO
Organization: Celestial Software, Mercer Island, WA
Date: Thu, 05 Nov 1992 17:06:14 GMT

In <1992Nov4.192544.4437@bnr.ca> cronejp@bnr.ca (Jonathan P. Crone) writes:

:>Xref: bcars267 biz.sco.opendesktop:1007 biz.sco.general:5094
:>From: losecco@undpdk.hep.nd.edu (John LoSecco)
:>Newsgroups: biz.sco.opendesktop,biz.sco.general
:>Subject: BSD line printer daemon on SCO
:>Date: 4 Nov 92 16:10:50 GMT
:>Organization: Notre Dame High Energy Physics
:>
:>Does anyone have the BSD lpd running on ans SCO box?  I would like to be
:able
:>to spool jobs to another system and also to act as server to the net.
:>We have the BSD spooler working on our RS/6000's and Silicon Graphics
:>Indigo's.

:I tried to get the SCO version of the BSD lpd working between a couple of
:printerless 
:Sparcstations and my SCO boxes with a HPLaser. Network printing between
:the printerless SCO box and the printer connected box worked fine, but
:any attempts to get the BSD lpd printing working between the SCO box
:and the Sparc failed miserably...

:I was getting deeply irritated and was in a rush so I used
:an extremely brute force technique. 
:One partition of the SCO server is NFS mounted by the Sparcs. So
:to print a file on the Sparc, the file is actually copied
:to the NFS partition. On the SCO server, every 5 minutes the
:following shell script looks at the directory, sees if there are any files
:there, and prints them....

:Ugly. Disgusting. But it worked better than fighting with the SCO BSD
:lpd...

I've used a slightly less ugly approach to printing over the
network.  I put this script in my PATH so that is executed by any
program invoking 'lp'.  I put this in /usr/local/bin which is in
my PATH before /bin and /usr/bin.  I use this same script as a
front-end for lp on the systems that have printers by commenting
out the rcmd lines and uncommenting the /usr/bin/lp lines.

The first part of the program parses for lp options which it
passes on to the lp program on the host with the printer.  The
last part either pipes the standard input to rcmd or loops
through the files and invokes rcmd (or /usr/bin/lp) with the
files redirected.  I originally wrote this script to get around
permissions problems where the 'lp' user couldn't read files I
was printing.

Some of this tailors -o options for my lpinterface script which
uses a syntax -o-options and use getopt internally to parse the
options.
:
# $Header: /u/usr/cvs/lbin/lp,v 1.5 92/10/26 18:16:32 bill Exp $
# @(#) $Id: lp,v 1.5 92/10/26 18:16:32 bill Exp $
# $Log:	lp,v $
# Revision 1.5  92/10/26  18:16:32  bill
# ----------------------------------------------------------------------
# 	1.	Use rcmd camco1 to use central printer.
# 
# Revision 1.4  91/06/14  11:50:55  src
# ----------------------------------------------------------------------
# 	1.	Modify for use with WP 5.0
# 
progname=`basename $0`
USAGE="Usage: $progname [-v] [-e environment]"

args=`echo $* | sed 's/-o *-/-o/g'`	# change -o-ps10... to -ops10
set -- `getopt cd:mn:o:rst:wvV $args`
if [ $? != 0 ]
then
	echo $USAGE
	exit 2
fi
lp_opts=''
for i in $*
do
	case $i in
		-[cmrsw])	# single argument flags to /usr/bin/lp
			lp_opts="$lp_opts $1"
			shift;;
		-[dnt])		# two arguments (remove space)
			lp_opts="$lp_opts $1$2"
			shift 2;;
		-o)
			case $2 in	#{	change WP to -n
				WP)		lp_opts="$lp_opts -o-n";;
				WP50)	lp_opts="-oWP50 $lp_opts";;
				*)		lp_opts="$lp_opts -o-$2";;
			esac	#}
			shift 2;;
		-[vV])
			verbose=$1
			set -x
			shift ;;
		--)	shift;
			break
			;;
	esac
done

if [ $# = 0 ] ; then
	rcmd camco1 /usr/bin/lp $lp_opts $*
	# /usr/bin/lp $lp_opts $*
else
	for file do
		rcmd camco1 /usr/bin/lp $lp_opts < $file
		# /usr/bin/lp $lp_opts < $file
	done
fi
-- 
INTERNET:  bill@Celestial.COM   Bill Campbell; Celestial Software
UUCP:   ...!thebes!camco!bill   6641 East Mercer Way
             uunet!camco!bill   Mercer Island, WA 98040; (206) 947-5591
SPEED COSTS MONEY -- HOW FAST DO YOU WANT TO GO?
Newsgroups: biz.sco.general