----- Original Message -----
From: "Rob Steinmetz" <rnotsteinmetz@notmindspring.com>
Newsgroups: comp.unix.sco.misc
To: <distro@jpr.com>
Sent: Saturday, July 22, 2006 4:21 PM
Subject: Re: Ancient SCO Unix Question
> Bill Campbell wrote:
>> On Sat, Jul 22, 2006, Rob Steinmetz wrote:
>>> I have been asked to convert an application from SCO Unix Open Desktop
>>> 3.0 to a more modern platform.
>>
>> I don't remember an OpenDesktop 3.0, 2.0 yes.
>
> I was wrong, according to the login in screen it is Open Server 3.O
>
> from the /usr/adm/messages I get
>
> SCO UNIX System V/386 Release 3.2v4.2 Operating System
>
>>
>> What's the output of ``uname -X''?
>
> Release = 3.2v4.2
> KernelID = 93/04/28
> Machine = i80486
> BusType = ISA
>
> I omitted some specific identification stuff.
>
>>
>> ...
>>> I have confirmed that the lpd target server works. I have Linux and
>>> Windows clients printing properly to it. The print requests seem to be
>>> stuck in the printer spool on the SCO server. TCP/IP connections seem to
>>> work including sort of cating files to port 515 and getting something to
>>> come out of the printer.
>>>
>>> The problem seems to be getting print request from the lpd spool
>>> directory to the lpd daemon.
>>
>> SCO's earlier attempts at network printing left something to be
>> desired. My solution has been to write my own printer interface
>> scripts using netcat to deliver the print jobs, bypassing SCO's
>> mechanism (and I hate the Berserkley lpd interface in any case ;-).
>
> Unfortunately, unless I can find a precompiled netcat binary which will
> work that's not really and option. There is no Development System.
>
> lpd seemed easy since it was apparently already there and I have a server
> which can accept the lpd requests and send them to my printer. hpnp is
> also there but none of my network printers are directly accessible making
> one available seemed like more work.
>
> This seemed like a simple problem when I started. I'm just trying to make
> it work well enough to complete the project.
A netcat binary that will run even on that version is readily available, as
is a sample printer interface scripts that uses it, on pcunix.com
http://aplawrence.com/SCOFAQ/FAQ_scotec7getnetcat.html
But wait, don't bother.

I finally got off my rear and wrote the universal network printer interface
script I always meant to write which allows me to share it finally.
Up to now I've been using a tar file that I just unpack onto any openserver
box and immediately I can just define a network printer in scoadmin just by
selecting one of:
HPLaserJet.nc, HPLaserJet.rlpr, epson.nc, epson.rlpr instead of HPLaserJet
or epson. And then defining a corresponding line in /etc/printers.
This was all based on the examples in the url above.
It was great, very convenient for me in that all I do is a single wget or
curl command, piped into tar and I can print in about one minute.
But those *.nc *.rlpr files were modified copies of the same scripts that
came with the OS, which I can't legally redistribute.
But now I finally made a simple, single, stand-alone wrapper script that
just runs any of the other scripts from the /usr/spool/lp/model directory
instead of containing one of them itself.
Which means now the directions for installing netcat and a netcat printer
are both very simple, and, the resulting printer functions the same as a
locally connected printer since it uses the same interface scripts you
select from in scoadmin for parallel port or serial printers. Previously you
had to write your own interface script from examples on Tony's site, and
then if you wanted to use an interface script you had to look at other
examples on Tony's site for making a virtual local printer that uses the
interface script and then just runs lp again to print to another printer, or
do like I did and hack up copies of sco's interface scripts.
The new universal script is short and sweet and is an improvement over the
previous netcat examples in that:
* allows use of rlpr as well as netcat. rlpr is a user space lpd/lpr client
that you use just like netcat. Although
the OS has and lpd client built in, it's not convenient to use for
several reasons.
* allows you to use all the same printer interface scripts as an local
printer
* looks & works the same as a local printer to the os & apps
* no writing your own interface scripts
* no kludgy virtual printers that just print to other printers and makes
duplicate printers in scoadmin & lpstat that everyone involved with that box
must know the messy details about ignoring certain printers and never using
them directly but also never deleting them etc...
* light/efficient. I managed to avoid running any child processes or
external binaries other than the interface script and the network util.
(like grep and basename and using backticks etc...)
* ready to add more protocols like smbclient, ftp, email etc...
/usr/spool/lp/model/Net:
---------------------
#!/bin/ksh
LP=/usr/spool/lp
export PATH="${LP}/bin:/bin:/usr/bin:/usr/lib:/usr/local/bin:/usr/gnu/bin"
SELF=${0##*/}
while : ; do
IFS=: read NAME HOST PORT PROTOCOL MODEL COMMENTS || break
[[ "$NAME" = "$SELF" ]] && break
done < /etc/printers
INTERFACE=${LP}/model/$MODEL
[[ -z "$MODEL" ]] && exit 1
[[ -e $INTERFACE ]] || exit 1
whence $PROTOCOL >/dev/null 2>&1 || exit 1
case $PROTOCOL in
netcat) $INTERFACE "$@" | netcat -h $HOST -p $PORT ;;
rlpr) $INTERFACE "$@" | rlpr -H $HOST -P $PORT ;;
esac
---------------------
But don't bother cut & pasting.
I just posted it because it's small and I like to look at it

Just grab this tar and unpack it as root.
http://www.aljex.com/bkw/sco/#rlpnc
Then create a Local Printer in scoadmin
Select "Net" for the model
Select or type-in /dev/null for the device
Then create a corresponding line in /etc/printers
There are comments and several examples in /etc/printers
The tar already includes a netcat binary that might run on your box, already
installed in a spot where the script expects it.
The rlpr binaries on the same web page probably (almost certainly) will not
work on your box. I don't think there are anough updates & patches available
to to allow the to run either.
You might need to get this netcat binary:
http://aplawrence.com/KevinSmith/netcat/netcat.coff
and save it as /usr/spool/lp/bin/netcat , overwriting the ELF one that I
included in the tar.
I don't know if r4.2 was elf yet, or if it's libraries will be compatible
enough even if it can run elf binaries.
Anyone else on osr5.anything can just untar and go. I've been using the same
binary for years on various 5.0.x
Brian K. White --
brian@aljex.com --
http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!