Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!cwjcc!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon S. Allbery) Newsgroups: comp.unix.wizards Subject: Re: lp: SysV/BSD interoperability Message-ID: <12639@ncoast.UUCP> Date: 2 Oct 88 17:43:09 GMT References: <160@leibniz.UUCP> <539@hptsug2.HP.COM> <23031@amdcad.AMD.COM> Reply-To: allbery@ncoast.UUCP (Brandon S. Allbery) Followup-To: comp.unix.wizards Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 76 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 < "$file" # UUCP version: uux - "$host"!lpr < "$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 !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