From: eea78555@twins (Hwan-Rei Lee)
Subject: Re: Unix LPR/LPD server for IBM PC?
Organization: EENCTU
X-Newsreader: Tin 1.1 PL3
Date: Wed, 16 Dec 1992 07:44:26 GMT

iversen@dsfys1.fi.uib.no (Per Steinar Iversen) writes:
: 
: 
: Is there available a package that allows an old PC AT with an Ethernet card to 
: serve as an LPR/LPD server for a fast PostScript printer? The printer is to be 
: used in a mixed network, the best solution would seem to be the Unix LPR 
: protocol. I have seen announcements of router and bridge software for PCs....
: Could this be done Pathworks?
: 
: -psi
	Hi!:
	I have just written two small shell scripts for both PC and Sun that
makes  PC serves as a printer spooler for Workstation. Our enviroment is
under PC/NFS by which we mount a directory under PC from Sun. And PC
look for files under that directory and prints out whenever it detects
files in that directory. ( Of course, some handshake files are needed
for acknowleging the printer ready, ... ). The scripts are listed below.
Hope it helps.
########## lpx in Sun, Csh ##########
#! /bin/csh -f
	if ( ! -f /twins-1/local/spool/print.ok ) then
		echo Printer Busy!
		echo Check if someone using PC-286 or Not in Spooling Mode
		exit
	endif
echo Printing Postsrcipt files to PC
	if ( -f /twins-1/local/spool/print.can) then
	echo Printer Busy!
	echo Submit later!
	exit
endif
foreach arg ( $argv )
	echo Submitting: $arg
	if ( -f /twins-1/local/spool/print.ok) then
		cp $arg /twins-1/local/spool
		chmod 777 /twins-1/local/spool/$arg
	else
		echo File Not Found!
	exit
	endif
end
echo OK > /twins-1/local/spool/print.can
chmod 777 /twins-1/local/spool/print.can
echo Use lpxq to check files at printing.
echo Use lpxd to remove unprinted files.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
################# lpxq in Sun 
#! /bin/csh -f
ls -l /twins-1/local/spool
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
################# lpxd in Sun 
#! /bin/csh -f
foreach arg ( $argv )
	echo Removing file: $arg
	if ( -f /twins-1/local/spool/$arg) then
		rm /twins-1/local/spool/$arg
	else
		usage: lpxd filename
	exit
	endif
end
rm -f /twins-1/local/spool/print.can  >& /dev/null
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
################# Spool.bat in PC-nfs using 4DOS batch commands for PC
@echo off
echo Waiting for Printing...
echos %_cwd`>`
iff %@ready[k:]==0 then ^ echo Spooler Directory not ready ^ goto end ^ endiff
loadbtm on
iff "%spool"=="spool" then ^ goto begin ^ endiff 
alias prompt=echo Do not Change Prompt In Spooler Mode!
iff exist k:\spool.bat then ^ copy k:\spool.bat c:\etc ^ endiff
if not "%aon"=="aon" call aon.bat ^ set aon=aon
net use k: /d >& NUL
NET USE k: \\twins\twins-1\local\spool /sh  >& nul
del k:\print.ok /q >& nul
set spool=spool
:begin
if %@exec[c:\bin\kbhit.exe]==1  goto done 
iff %@ready[k:] != 1 then ^ goto end ^ endiff
iff not exist k:\print.ok then ^ echo OK > k:\print.ok ^ endiff
iff not exist k:\print.can then ^ goto begin ^ endiff
del k:\print.ok /q  >& NUL
delay 1
for %a in ( k:\*.ps ) do ( echo Printing %a .... ^ copy %a c:\tmp\temp.ps /q^ iff %@lpt[3] == 1  then ^ copy c:\tmp\temp.ps lpt3: ^ del c:\tmp\temp.ps /qy  ^ endiff )
for %a in ( k:\*.txt ) do ( echo Printing %a ....^ c:\nfs\unix2dos %a >  c:\tmp\temp.txt ^ text2ps c:\tmp\temp.txt > c:\tmp\temp.ps ^ copy c:\tmp\tmp.ps lpt3: )
del k:\*.ps /q >& nul
del k:\*.txt /q >& nul
del k:\print.can /q >& nul
echos %_cwd`>`
goto begin
:done
iff "%p"=="" then^ set p=s ^ set prompt=`%@exec[c:\etc\spool.bat]`[1D ^ endiff
del k:\print.ok /q  >& NUL
:end 
Newsgroups: comp.protocols.tcp-ip.ibmpc