Remote printing
John Buchanan
buchanan at cs.ubc.ca
Sat Apr 14 07:02:27 AEST 1990
In article <11968 at nlm-mcs.arpa> states at tech.NLM.NIH.GOV (David States) writes:
>In article <8448 at tank.uchicago.edu> kur7 at tank.uchicago.edu (Shin Kurokawa) writes:
>>
>>Any suggestions on how I can make a 4D/220 to access the printer
>>that is physically connected to a BSD unix system on the
>>network?
>
We have a printer hooked up to a PI, but would also like to provide access
to the other printers which are attached to BSD machines. The following
csh script has done the job for us. It is slow but works.
#!/bin/csh -f
#
# lpr fake for Sys V
#
# Fake a minimal lpr
#
# John Buchanan 26 Feb 1990
#
# the users must have a .rhosts which allows them access to both
# hosts.
set FILES = ()
set WOODY_HOST = abbott
set OTHER_HOST = grads
#default printer.
set PRINTER = woody
#available printers
set PRINTERS = (woody \
garibaldi lw gari lw334 \
tusk lw244 \
clinker clink lwd lwdraft \
fissile lw332 \
wedge lw312 \
)
#
#Parse the arguments only -P is allowed right now.
#
while (${#argv} >= 1)
set flag = `echo $argv[1] | awk ' /\-..*/ {print substr($1,2,1) }'`
if ($flag != "") then
switch ($flag)
case "P":
set PRINTER = `echo $argv[1] | sed 's/-P//'`
breaksw
default:
echo Unknown flag $argv[1]
exit 1
endsw
else
set FILES = ($argv[1] ${FILES})
endif
shift
end
#
# if no files we assume stdin
#
if ( ${#FILES} == 0) then
set FILES = ( /tmp/${USER}.lpr.tmp )
cat > /tmp/${USER}.lpr.tmp #copy stdin to /tmp
endif
#check to see if it is a valid printer
set NOT_VALID = 1
foreach i ($PRINTERS)
if ($i == $PRINTER) set NOT_VALID = 0
end
if ($NOT_VALID == 1) then
echo Sorry: the printer $PRINTER is unknown
echo known printers are $PRINTERS
exit 1
endif
#
# set up the printer spec
#
if ( ${PRINTER} == woody ) then
set PRINT_HOST = ${WOODY_HOST}
set LP = "lp -c -o-h -dwoody"
else
set PRINT_HOST = ${OTHER_HOST}
set LP = (lpr -P${PRINTER} )
endif
#
# for each file copy to /tmp on the PRINT_HOST machine and then
# print them out.
#
foreach i (${FILES})
rcp $i ${PRINT_HOST}:/tmp/lpr.${USER}.from.imager
rsh ${PRINT_HOST} $LP /tmp/lpr.${USER}.from.imager
rsh ${PRINT_HOST} /bin/rm /tmp/lpr.${USER}.from.imager
end
#remove tmp file if input was stdin.
if (-e /tmp/${USER}.lpr.tmp ) /bin/rm /tmp/${USER}.lpr.tmp
#end of lpr
More information about the Comp.sys.sgi
mailing list