psncd, if, and if.sh:

This directory contains three utilities designed to work with the BSD
spooler to provide support for the Apple LaserWriter family of printers
connected to the serial port of NCD network display stations.

psncd can be used alone to send PostScript data to a LaserWriter
attached to an NCD network display station.  Just give it the hostname
or IP address of the display station as it's only argument.  It reads
it's standard input and writes that to the printer.  It takes any text
back from the printer and displays it on standard error.  This will
include any errors, output requests included in the PostScript, or any
attention messages such as out of paper.

So, for example to send a window dump to the printer on ncdu20:

% xwd | xpr -device lw | psncd ncdu20

If the paper runs out you'll see something like:

900205 12:12:28: psncd: ncdu82: %%[ PrinterError: out of paper ]%%
900205 12:14:31: psncd: ncdu82: %%[ PrinterError: no paper tray ]%%

displayed on the terminal.  The first two fields are a time stamp.
This is followed by the program name and the network display station
name.  The final text is what the printer returned.

Here's another example showing what happens if you just send text to
the printer:

% date | psncd ncdu82
900205 13:08:00: psncd: ncdu82: %%[ Error: undefined; OffendingCommand: Mon ]%%
900205 13:08:00: psncd: ncdu82: %%[ Flushing rest of job (to end-of-file) will be ignored ]%%

Normally we use lwf (available on the net) to convert text to
PostScript.  One of the inconveniences of the BSD spooler we weren't
willing to put up with was having to specify what kind of data was
being spooled.  People here were sending either text or PostScript and
the System V spooler was recognizing which it was and converting as
necessary.

For this we use the if (it started out as a spooler input filter, thus
the name if) program.  It's program that tests for PostScript or text
and executes the appropriate pipeline of commands.  (One flaw with this
scheme is that only the exit status of the last entry in the pipeline
is reported back to the spooler.) It takes all of the standard
arguments of an input filter (in the BSD spooler sense) and two
extras:  -t and -p.

The -t flag is followed by the pipeline of commands used to print
text.  The -p flag is followed by the pipeline of commands used to
process PostScript.

We use this program in the shell script if.sh.  It's if.sh that we
specify as our input filter.  We use an input filter so that we can see
each job individually and control the banner page.  if.sh contains an
invocation of if which references psncd.  RTSL (Read The Source Luke).

Here's what our /etc/printcap entry looks like:

	lp1|bldg1|lp|ps|lw|Apple LaserWriter on NCD unit in building 1:\
		if=/usr/local/lib/if.sh:\
		lf=/usr/adm/lpd-errs:\
		lp=/dev/null:\
		sh:\
		sd=/usr/spool/lp1:

We run our Apple LaserWriter II NTX at 38400 on an NCD network display
station named ncdu82.
