NAME
lwsrv - simple LaserWriter spooling agent

SYNOPSIS
lwsrv -n <object> -p <printer queue> -a <dictionary directory> -f
<FontFile> [ -MS ] [ -A <on | off> ] [ -T <crtolf | quote8bit |
makenondscconformant> ]

DESCRIPTION
lwsrv is a multi-threaded LaserWriter spooler (e.g. multiple
incoming jobs are allowed) that advertises itself on the AppleTalk
internetwork and accepts print jobs from Macintosh computers as if
it were a real LaserWriter. lwsrv allows these jobs to be queued
for printing via the standard Berkeley lpd spooling software (it is
easily modified for other systems). lwsrv assumes that it is
spooling for a particular type of LaserWriter printer as defined by
an input file that specifies the font coordination list.

A generic problem with LaserWriter spoolers is that the proper
Apple dictionary must be downloaded to the LaserWriter. An Apple
dictionary is the "prologue" code termed a "Procedure Set" or
"ProcSet", sent by the LaserWriter driver on a Macintosh (contained
in LaserPrep), that defines a "set" of routines for use by
Macintosh applications.

lwsrv attempts to resolve this problem by inserting the proper
dictionary in the incoming jobs before spooling them.
Unfortunately, lwsrv does not know about these ProcSets a priori.
They must be supplied to it, though it does attempt to retrieve
them from the client.

lwsrv will be able to record an unknown ProcSet if it follows
Version 2 of the Adobe Systems PostScript Document Structuring
Conventions (DSC). Any Apple LaserPrep of version 4.0 or higher
should do this. (Warning: the ProcSet as uploaded must be edited.)

lwsrv is normally started automatically at boot time from
/etc/rc.local. Unless debug flags are set, it will automatically
put itself into the background to run as a daemon.

REQUIRED ARGUMENTS
-n <object>
is used to specify the printer name that will be
registered (e.g. that will show up in Chooser). It may be
up to 31 characters long.

-p <printer queue>
specifies the name of the Unix printer queue to which
lwsrv will send the spooled print requests. <printer
queue> should exist in /etc/printcap.

-a <dictionary directory>
specifies the name of the directory that will hold the
various Procedure Sets (of which an AppleDict in a
LaserPrep is a particular instance). The first line of a
ProcSet must be "%%BeginProcSet: <procsetname>". In
addition, unknown ProcSets will be recorded in this
directory if possible. Received ProcSets will require
some editing.

-f <FontFile>
specifies the file that contains a Font Coordination List.
It essentially tells the Macintosh or other devices
spooling to lwsrv what fonts exist on the actual print
device.

OPTIONS
-A <on | off>
defines whether lwsrv should suppose that all client
programs speaking to it will properly follow the Adobe
Document Structuring Convention version 2.0. For now, all
it really does is define where the procedure set
definitions are loaded. Turning this on, when there is a
client program that doesn’t quite follow the conventions,
may cause the procedure set not to be loaded or to be
loaded in the wrong place. (Specifically, it looks for an
IncludeProcSet instruction). The default value is set at
installation time (see LOCAL CONFIGURATION section,
below).

-M facilitates accounting for print requests issued from Mac
applications. It causes lwsrv to accept a print request
only if the user is logged in under MachTen on the
Macintosh from which the request was made. This user
authentication is supported by the ’macinfo’ service of
the inetd daemon running on the requesting Macintosh. If
printing quotas are enforced, lwsrv also checks that the
user has a valid quota.

-S tells lwsrv that it should run in a single fork.
Normally, lwsrv forks off a child to deal with each print
request to minimize contention. Unfortunately, status
information returned to the client programs is not as
detailed when lwsrv is running multiforking.

-T <crtolf | quote8bit | makenondscconformant>
are TransScript compatibility options. Since the names
are so long, spaces, hyphens (-), underscores (_), and
tabs are allowed to enhance readability, for example:
-T "cr to lf" -T "quote 8-bit"

quote8bit
is used to quote 8 bit characters since
TransScript masks characters to 7 bits. Warning:
this could potentially cause problems if the
PostScript interpreter does not decode the quoted
characters in some circumstances.

crtolf is used to translate the Macintosh end of line
terminator CR (carriage return) to the UNIX end
of line terminator LF (line feed). This is
necessary if the spooled file will be run through
TranScript filters like psrv or psrev that assume
the UNIX end of line terminator. Warning: this
can potentially cause problems with binary data
streams.

makenondscconformant
should be used when lwsrv is spooling to a UNIX
printer queue that filters files through psrv (a
page reversal filter). This is standard for
serial TranScript printers and may have been
configured that way for papif. This option causes
the printed file to be prepended with a line
containing "%!" so that it looks like it does not
conform to the DSC. The problem is that in
version 2.0 of TranScript psrv leaves out part of
the file when handling DSC version 2.0 documents.

DEBUGGING OPTIONS
-r keeps the file spooled from the Macintosh for inspection
instead of removing it after printing.

-t <TraceFile>
is used to record all data received from the remote side in
<TraceFile>. The remote side is also forced to send any
ProcSets used. The result is not printed.

-l <LogFile>
is used to specify an activity log file.

-d <cap debug flags>
can be used to specify standard cap library debugging
flags.

EXAMPLE
For example, to publish a LaserWriter spooler "Laser" that prints
on the UNIX printer "ps" with Procedure sets recorded in
/usr/lib/adicts and using the font coordination list
/usr/lib/LWPlusFonts, you would start lwsrv as follows:
lwsrv -n Laser -p ps -a /usr/lib/adicts -f /usr/lib/LWPlusFonts

MACHTEN CONFIGURATION
Some Apple LaserPrep ProcSets (dictionaries) are supplied in
/usr/lib/adict, under license from Apple Computer.

The /etc/printcap entry on the spooling machine must contain an
"at=’printer_identifier’" entry to specify the physical printer to
use.

lwsrv should be run with option -S on any Macintosh with minimal
RAM. This conserves available memory for use by other desired
applications.

NOTES
There are a number of "font list files" that are used in the dialog
with the spooling client. These tell the client (Macintosh) what
fonts are available on the "supposed" printer. The laser font
files supplied may not work for all LaserPreps. They are known to
work for LaserPreps 3.0 through 5.2.

BUGS
lwsrv cannot properly update the status message. When printing
from a Macintosh, you will see the message "Starting job" until it
completes.

Macintosh applications cannot print to an lwsrv printer running on
the same machine as the application.

FILES
Sample font list files in the CAP distribution:
/usr/lib/LWFonts fontfile list for LaserWriter
/usr/lib/LWPlusFonts fontfile list for LaserWriter Plus

AUTHOR
lwsrv was written by Bill Schilit, Computer Science Department, and
Charlie C. Kim, User Services, Columbia University

SEE ALSO
lpr(1), inetd(8), pquota(8)