[comp.unix.wizards] lp: SysV/BSD interoperability

tpc@leibniz.UUCP (Tom Chmara) (09/16/88)

We have a number of different workstations around here.  I'm having trouble
trying to get the HP workstations (which use the AT&T System V spooling
facilities) to be able to use the SUN file server's printer (SUN uses the
Berkeley spooling facility).
Any chance to get one to recognize/work with the other?  Am I destined to
have to port the Berkeley stuff to the HP environment or vice-versa?
	Please advise...
		---tpc---

-- 
I am sole owner of the above opinions. Licensing inquiries welcome.
------------------------------------------------------------------------
Tom Chmara			UUCP:  ..utgpu!bnr-vpa!bnr-di!leibniz!tpc
BNR Ltd.  			BITNET: TPC@BNR.CA

allbery@ncoast.UUCP (Brandon S. Allbery) (09/24/88)

As quoted from <160@leibniz.UUCP> by tpc@leibniz.UUCP (Tom Chmara):
+---------------
| We have a number of different workstations around here.  I'm having trouble
| trying to get the HP workstations (which use the AT&T System V spooling
| facilities) to be able to use the SUN file server's printer (SUN uses the
| Berkeley spooling facility).
+---------------

I'd set up an lp despooler to spool the print job to the Sun, then use the
System V spooler.  You can either use a single spool queue and specify the
Sun spool queue in the -o options argument, or define lp spooler names based
on Sun spooler names and extract the proper spool queue for the Sun from $0
in the lp dequeuer.  Send me mail if you'd like more information on this;
I've already used this trick to spool print jobs over uucp.

++Brandon
-- 
Brandon S. Allbery, uunet!marque!ncoast!allbery			DELPHI: ALLBERY
	    For comp.sources.misc send mail to ncoast!sources-misc
"Don't discount flying pigs before you have good air defense." -- jvh@clinet.FI

tai@hptsug2.HP.COM (Tai Jin) (09/24/88)

In article <160@leibniz.UUCP> tpc@leibniz.UUCP (Tom Chmara) writes:
|We have a number of different workstations around here.  I'm having trouble
|trying to get the HP workstations (which use the AT&T System V spooling
|facilities) to be able to use the SUN file server's printer (SUN uses the
|Berkeley spooling facility).
|Any chance to get one to recognize/work with the other?  Am I destined to
|have to port the Berkeley stuff to the HP environment or vice-versa?
|	Please advise...
|		---tpc---

In HP-UX 6.2 and 2.0 the rlp spooler is compatible with the BSD
spooler but uses SYS V models, etc.  You should be able to use it to
send and accept print requests to and from other BSD spoolers.

...tai

hayes@crackle.amd.com (Jim Hayes) (09/25/88)

In article <160@leibniz.UUCP> tpc@leibniz.UUCP (Tom Chmara) writes:
>We have a number of different workstations around here.  I'm having trouble
>trying to get the HP workstations (which use the AT&T System V spooling
>facilities) to be able to use the SUN file server's printer (SUN uses the
>Berkeley spooling facility).
>Any chance to get one to recognize/work with the other?  Am I destined to
>have to port the Berkeley stuff to the HP environment or vice-versa?
>	Please advise...
>		---tpc---

The Berkeley stuff ports quite easily into System V (or SVRx/BSD
hybrids) containing socket(), accept(), bind() and connect().  There
are only a couple of issues that might slow things, but nothing
significant.

1) Some System V TCP/IP environments (i.e. WIN/TCP for 3B2 circa last year)
   don't support UNIX domain sockets, so the code should be modified to 
   use an internet domain socket instead of the UNIX dom. /dev/printer.

2) Two new printcap fields are needed to set/reset System V tty control
   bits properly. 

3) The fork()ing/reclamation of print filters is BSD specific and needs
   some simple tweaking.

Porting lpd and friends to a new environment takes 8-10 hours the first time,
with each additional environment requiring less.  The outcome is a nice
standardized printing environment...

<disclaim.h>
Check your BSD license agreement before using their code.


-Jim Hayes                         Advanced Micro Devices, Inc., Sunnyvale CA.
                                   hayes@amdcad.amd.com
/earth: file system full           {ucbvax|sun|decwrl}!amdcad!hayes
                                   These are not opinions of AMD.     

allbery@ncoast.UUCP (Brandon S. Allbery) (10/03/88)

As quoted from <23031@amdcad.AMD.COM> by hayes@crackle.amd.com (Jim Hayes):
+---------------
| In article <160@leibniz.UUCP> tpc@leibniz.UUCP (Tom Chmara) writes:
| >We have a number of different workstations around here.  I'm having trouble
| >trying to get the HP workstations (which use the AT&T System V spooling
| >facilities) to be able to use the SUN file server's printer (SUN uses the
| >Berkeley spooling facility).
|
| (description of porting Sun "lpr" to System V omitted)
+---------------

The problem with this is convincing existing applications under System V to
use the Sun spooler.  However, one can instead use the System V spooler to
send print requests to another machine for printing.

I've had a few requests for this, and in fact just set up networked printers
under WIN/3B for a client.  Here's what I mailed to the original requester:

--------
  You'll have to bear with me; I don't know how the BSD spooler works, so I
  can only approximate some things.  I can, however, tell you enough that you
  should be able twork out the rest for the BSD case.
  
  First you need to select the printer ID's; does the BSD spooler use names or
  numbers?  It doesn't really matter; on the System V end define the printer
  names as "hostname_printerid".  Then the despooler becomes:
  
  printer="`basename $0`"		# is "interface/{printername}"
  user="$2"			# login name of person who spooled job
  title="$3"			# optional user-specified banner line
  copies="$4"			# number of copies to print, usually 1
  options="$5"			# random options via "-o", probably unused
  shift; shift; shift; shift; shift
  host="`echo \"$printer\" | sed 's/\([^_][^_]*\)_.*/\1/'`"
  lprid="`echo \"$printer\" | sed 's/[^_][^_]*_//'`"
  
  for file in "$@"; do
  # Note:  "remsh" is from WIN/3B; I don't know if HP uses "remsh" or instead
  # uses "rsh" and doesn't support the restricted shell.
  # The "options" can be used to pass the banner title line, number of copies,
  # and (most important) the print queue to use, in BSD format.
  	remsh "$host" lpr <options> < "$file"
  # UUCP version:
  	uux - "$host"!lpr <options> < "$file"
  # UUCP to a System V system; this is the one I was talking about earlier
  	uux - "$host"!lp -t"$title" -o"$options" -n"$copies" -d"$lprid" < "$file"
  # And I just did this one for a client yesterday!
  	remsh "$host" lp -t"${user}${title:+\": \"}${title}" -o"$options" -n"$copies" -d"$lprid" < "$file"
  # (the fancy footwork in the "-t" option sticks the username in the banner
  # and separates it from the original banner with a colon/space IF there was
  # a title.  See the System V manual under sh(1).)
  #
  # NOTE:  To complete this, create a user "lp" on the Sun, which can do nothing
  # (or very little) except execute "lpr".  If you're not into security, you can
  # let "lp" do anything.  If "lp" is used, choose another name and add a "-l"
  # option to the above "remsh" lines; and give the user a ".rhosts" which allows
  # "lp" to use the login name.  There may be a bit more involved in plugging
  # any security holes; I haven't enough experience with TCP/IP to know all the
  # possible holes.  The restricted "lp" login is probably safest.
  done
  exit 0
  
  You can use, mangle, etc. the above to fit your needs.
--------

You'll note support for WIN/3B and UUCP.  If you have another network which
supports remote command execution, it can easily be adapted to the above
format; ditto for other print spoolers.  It's also a good example of the
flexibility of the "lp" spooler.  (plug, plug ;-)

++Brandon
-- 
Brandon S. Allbery, uunet!marque!ncoast!allbery			DELPHI: ALLBERY
	  For comp.sources.misc send mail to <backbone>!sources-misc
comp.sources.misc is moving off ncoast -- please do NOT send submissions direct
ncoast's days are numbered -- please send mail to ncoast!system if you can help