
#ident "@(#)README	13.1	90/07/23"

This directory has been updated for version 2.2 of the NCD X server
boot and font tapes.  The first part of this file covers the changes
made.  After the line of dashes is the previous content of the file.

The following changes were made for 2.2:

 1) The source file was renamed ncdprint.c, which was the original file
    name given by the author.  The supplied Makefile knows how to make
    the appropriate executables from this source.  Basically there are
    a couple of compile-time values that control everything.  They
    are:

    DEBUG -- which, if set, will cause numerous debug messages to
	appear on stderr of the utilities.

    DNET -- causes ULTRIX DECnet sockets to be used rather than TCP/IP
	sockets.

    PS -- indicates that the printer to be driven is a PostScript
	printer and that it provides the same interface as the Apple
	LaserWriter (^D resets the printer and is echoed back when
	reset is complete among other things).

    The two executables are ps2ncd which sends PostScript to a
    PostScript printer and cat2ncd which just sends a stream of bytes
    to the serial port of the NCD unit (used for HP LaserJet IIP).

 2) The Makefile was added.  make clean will remove all of the
    executables as well as any printer-related links made to the
    interface script.

 3) The naming convention for the spooler interface script has
    changed.  Basically to cause spooled jobs to go to the attached
    printer, invoke

	make <printer-type> NCD=<address>

    where

    <printer-type> is lw for Apple LaserWriter compatible printers or
	ljiip for the HP LaserJet IIP printer.

    <address> is the address of the NCD unit with the attached
	printer.  This address can be of the form 192.43.153.79 (IP
	address), ncdu20 (host name or DECnet node name), or 1.79
	(DECnet).

 4) if.sh has been changed to handle both LaserWriter and LaserJet
    printers.

 5) The naming convention for the input filter name has been changed.
    The old form of *.<hostname> has been replaced by
    *%<printer-type>%<address>.  This shouldn't be too much trouble
    since you only need to enter this name in the /etc/printcap file
    once for each printer.  The reason for changing the period to a
    percent was to allow IP addresses which contain periods as
    delimiters.

    So for instance if%ljiip%192.43.153.79 tells the if.sh interface
    script that the printer is an HP LaserJet IIP and that it can be
    found at address 192.43.153.79.

    Keep in mind that the printcap file should reference a link to
    if.sh created by make <printer-type> NCD=<address> as described
    above.

 6) There is now code (for the LaserJet only, unfortunately) to
    recognize the page width option (e.g., -w75) and to use this to
    determine whether to print in portrait or landscape mode.

 7) A new utility, chr, has been included.  This provides a simple way
    to spit out control characters such as escape without putting them
    in the shell script (this causes headaches if you happen to cat the
    shell script).  It's dumb and we know it.

To build everything, say make all or make dnet (if you want ULTRIX
DECnet).

Don't forget you have to provide your own text to PostScript code (we
use Barry Brachman's lwf here at NCD).  Also, certain tradeoffs were
chosen to add support for the LaserJet IIP.  We've chosen to do most of
the printer interface work in the shell script, feeling that this
provides a better example of interfacing to the NCD unit.  Note that
not all spooler options are processed and not all that are processed
are processed the same for either type of printer.  Hopefully this will
get better over time.

The printcap entries used for testing were:

ljtest:\
	if=/usr/local/bin/if%ljiip%192.43.153.79:\
	lf=/usr/adm/lpd-errs:\
	lp=/dev/ljtest:\
	sh:\
	sd=/usr/spool/ljtest:\
	pw#80:\
	pl#60:
lwtest:\
	if=/usr/local/bin/if%lw%ncdu82:\
	lf=/usr/adm/lpd-errs:\
	lp=/dev/lwtest:\
	sh:\
	sd=/usr/spool/lwtest:

We hope that this directory helps in your efforts to interface to the
serial port on your NCD.  Tell us if anything is wrong or you'd like to
suggest changes.  Just send mail to support@ncd.com or call technical
support at (415)694-0650.

------------------------------------------------------------------------------

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 (from volume 15 of the usenet news group
comp.sources.unix) 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.
