2 |
- |
1 |
.HTML "A Guide to the Lp Printer Spooler
|
|
|
2 |
.TL
|
|
|
3 |
A Guide to the Lp
|
|
|
4 |
Printer Spooler
|
|
|
5 |
.AU
|
|
|
6 |
Paul Glick
|
|
|
7 |
pg@plan9.bell-labs.com
|
|
|
8 |
.AB
|
|
|
9 |
.PP
|
|
|
10 |
.I Lp
|
|
|
11 |
is a collection of programs used to provide an easy-to-use
|
|
|
12 |
interface for printing a variety of document types on a variety
|
|
|
13 |
of printers.
|
|
|
14 |
.I Lp
|
|
|
15 |
is the glue that connects various document language
|
|
|
16 |
translators and printer communication programs together so that
|
|
|
17 |
the users may have a consistent view of printers.
|
|
|
18 |
Most of the glue
|
|
|
19 |
is shell script, which can be easily modified.
|
|
|
20 |
The user need not
|
|
|
21 |
specify options to get sensible output in most cases.
|
|
|
22 |
.I Lp
|
|
|
23 |
is described here
|
|
|
24 |
so that others may make additions and changes.
|
|
|
25 |
.AE
|
|
|
26 |
\" .2C
|
|
|
27 |
.NH
|
|
|
28 |
Introduction
|
|
|
29 |
.PP
|
|
|
30 |
.I Lp
|
|
|
31 |
is used to format and print data on a variety of output devices.
|
|
|
32 |
The need for
|
|
|
33 |
.I lp
|
|
|
34 |
was rooted in the inability of other printer spoolers to do simple
|
|
|
35 |
tasks without a great deal of user specification of options.
|
|
|
36 |
At the time
|
|
|
37 |
.I lp
|
|
|
38 |
was written, there were several printer
|
|
|
39 |
languages, such as ImPress and PostScript, and
|
|
|
40 |
an internally developed printer that would accept
|
|
|
41 |
.I troff
|
|
|
42 |
output.
|
|
|
43 |
Now, all our printers take PostScript,
|
|
|
44 |
but printers that use HPCL and HPGL abound and
|
|
|
45 |
support for those printers may be added easily.
|
|
|
46 |
A great deal of what underlies
|
|
|
47 |
.I lp
|
|
|
48 |
is taken from BSD's
|
|
|
49 |
.I lpr
|
|
|
50 |
and System V's
|
|
|
51 |
.I lp .
|
|
|
52 |
The important features of this system are that most of the programs
|
|
|
53 |
are easily modified shell scripts and the user need not
|
|
|
54 |
learn to use the large amount of underlying software developed by others.
|
|
|
55 |
.I Lp
|
|
|
56 |
runs under Plan 9 and several flavors of
|
|
|
57 |
UNIX.
|
|
|
58 |
This document deals with
|
|
|
59 |
.I lp
|
|
|
60 |
as it relates to Plan 9.
|
|
|
61 |
.I Lp
|
|
|
62 |
was developed using both Datakit and Ethernet to transport data between machines.
|
|
|
63 |
Now only the Ethernet transport mechanism remains.
|
|
|
64 |
.PP
|
|
|
65 |
Text, graphics, and formatted text files are appropriately processed and
|
|
|
66 |
placed into a spool directory from which they are taken to be printed by a daemon process.
|
|
|
67 |
Additional functions include checking the status of a printer queue
|
|
|
68 |
and removing jobs from the printer queue.
|
|
|
69 |
.PP
|
|
|
70 |
All the shell scripts (see
|
|
|
71 |
.I rc (1))
|
|
|
72 |
associated with
|
|
|
73 |
.I lp
|
|
|
74 |
reside in the spool directory
|
|
|
75 |
.CW /sys/lib/lp
|
|
|
76 |
except for the
|
|
|
77 |
.I lp
|
|
|
78 |
command itself, which resides in
|
|
|
79 |
.CW /rc/bin .
|
|
|
80 |
Commands related to
|
|
|
81 |
.I lp
|
|
|
82 |
that are not shell scripts can most often be found
|
|
|
83 |
in
|
|
|
84 |
.CW /$cputype/bin/aux .
|
|
|
85 |
The directory where all the
|
|
|
86 |
.I lp
|
|
|
87 |
scripts reside is defined within
|
|
|
88 |
.I lp
|
|
|
89 |
by the shell variable
|
|
|
90 |
.CW LPLIB .
|
|
|
91 |
In the remainder of this document, file names will be specified
|
|
|
92 |
with this shell variable as their root.
|
|
|
93 |
.NH
|
|
|
94 |
Usage
|
|
|
95 |
.PP
|
|
|
96 |
.I Lp
|
|
|
97 |
requires an output device to be specified
|
|
|
98 |
before it will process input.
|
|
|
99 |
This can be done in any of three ways described here.
|
|
|
100 |
.IP 1)
|
|
|
101 |
The file
|
|
|
102 |
.CW $LPLIB/defdevice
|
|
|
103 |
may contain the name of a default output device.
|
|
|
104 |
This may not be practical for environments where
|
|
|
105 |
there are many printers.
|
|
|
106 |
.IP 2)
|
|
|
107 |
The user's environment variable
|
|
|
108 |
.CW LPDEST
|
|
|
109 |
may be set to the name of the device to be used.
|
|
|
110 |
This is often a more practical solution when there are several printers
|
|
|
111 |
available.
|
|
|
112 |
This overrides a
|
|
|
113 |
.CW defdevice
|
|
|
114 |
specification.
|
|
|
115 |
.IP 3)
|
|
|
116 |
The
|
|
|
117 |
.CW -d
|
|
|
118 |
.I printer
|
|
|
119 |
option to the
|
|
|
120 |
.I lp
|
|
|
121 |
command specifies
|
|
|
122 |
.I printer
|
|
|
123 |
as the device to which output should be directed, overriding the
|
|
|
124 |
previous two specifications.
|
|
|
125 |
.PP
|
|
|
126 |
.ti 0
|
|
|
127 |
If
|
|
|
128 |
.I printer
|
|
|
129 |
is
|
|
|
130 |
.CW ? ,
|
|
|
131 |
a list of printers and other information in the
|
|
|
132 |
.CW devices
|
|
|
133 |
file is printed, as shown in Figure 1.
|
|
|
134 |
Quote the question mark to prevent it from being
|
|
|
135 |
interpreted by the shell language as a metacharacter.
|
|
|
136 |
\" .1C
|
|
|
137 |
.KF
|
|
|
138 |
.P1
|
|
|
139 |
% lp -d'?'
|
|
|
140 |
device location host class
|
|
|
141 |
fn 2C-501 helix post/2+600dpi+duplex
|
|
|
142 |
pcclone - - post+nohead
|
|
|
143 |
peacock 2C-501 cetus post/2+300dpi+nohead+color
|
|
|
144 |
ps83 st8_fl3 rice post+300dpi+reverse
|
|
|
145 |
psu 2C-501 cetus post/2+1200dpi
|
|
|
146 |
.
|
|
|
147 |
.
|
|
|
148 |
.
|
|
|
149 |
%
|
|
|
150 |
.P2
|
|
|
151 |
.ce
|
|
|
152 |
.I "Figure 1. Sample listing of installed printers"
|
|
|
153 |
.KE
|
|
|
154 |
.PP
|
|
|
155 |
Normally,
|
|
|
156 |
.I lp
|
|
|
157 |
uses the
|
|
|
158 |
.CW file
|
|
|
159 |
command to figure out what type of input it is receiving.
|
|
|
160 |
This is done within the
|
|
|
161 |
.CW generic
|
|
|
162 |
process which is discussed later in this paper in the
|
|
|
163 |
.B "Process directory"
|
|
|
164 |
section.
|
|
|
165 |
To select a specific input processor the
|
|
|
166 |
\f(CW-p\fP\fIprocess\fP
|
|
|
167 |
option is used where
|
|
|
168 |
.I process
|
|
|
169 |
is one of the shell scripts in the
|
|
|
170 |
.CW process
|
|
|
171 |
directory.
|
|
|
172 |
.LP
|
|
|
173 |
Troff
|
|
|
174 |
output can be printed, in this case, on printer
|
|
|
175 |
.I fn
|
|
|
176 |
with
|
|
|
177 |
.P1
|
|
|
178 |
% troff -ms lp.ms | lp -dfn
|
|
|
179 |
.P2
|
|
|
180 |
.LP
|
|
|
181 |
A file can be converted to PostScript using the pseudo-printer
|
|
|
182 |
.CW stdout :
|
|
|
183 |
.P1
|
|
|
184 |
% troff -ms lp.ms | lp -dstdout > lp.ps
|
|
|
185 |
.P2
|
|
|
186 |
LaTeX (and analogously TeX)
|
|
|
187 |
documents are printed in two steps:
|
|
|
188 |
.P1
|
|
|
189 |
% latex lp.tex
|
|
|
190 |
.
|
|
|
191 |
.
|
|
|
192 |
% lp lp.dvi
|
|
|
193 |
.
|
|
|
194 |
.
|
|
|
195 |
%
|
|
|
196 |
.P2
|
|
|
197 |
LaTeX
|
|
|
198 |
produces a `.dvi' file and
|
|
|
199 |
does not permit the use of a pipe
|
|
|
200 |
connection to the standard input of
|
|
|
201 |
.I lp .
|
|
|
202 |
To look at the status and queue of a device, use
|
|
|
203 |
.CW -q :
|
|
|
204 |
.P1
|
|
|
205 |
% lp -dpsu -q
|
|
|
206 |
daemon status:
|
|
|
207 |
: 67.17% sent
|
|
|
208 |
printer status:
|
|
|
209 |
%%[ status: busy; source: lpd ]%%
|
|
|
210 |
|
|
|
211 |
queue on cetus:
|
|
|
212 |
job user try size
|
|
|
213 |
rice29436.1 pg 0 17454
|
|
|
214 |
slocum17565.1 ches 1 49995
|
|
|
215 |
%
|
|
|
216 |
.P2
|
|
|
217 |
This command can print the status and queue of the local
|
|
|
218 |
and remote hosts.
|
|
|
219 |
Administrators should be advised that working in an environment where the
|
|
|
220 |
.I lp
|
|
|
221 |
spool directory is shared among the local and remote hosts,
|
|
|
222 |
no spooling should be done on the local hosts.
|
|
|
223 |
The format of the status and queue printout is up to the administrator.
|
|
|
224 |
The job started above can be killed with
|
|
|
225 |
.CW -k :
|
|
|
226 |
.P1
|
|
|
227 |
$ lp -dpsu -k rice29436.1
|
|
|
228 |
rice29436.1 removed from psu queue on cetus
|
|
|
229 |
.P2
|
|
|
230 |
.NH
|
|
|
231 |
Options
|
|
|
232 |
.PP
|
|
|
233 |
There are options available to modify the way in which a job is handled.
|
|
|
234 |
It is the job of the
|
|
|
235 |
.I lp
|
|
|
236 |
programs to convert the option settings so they may be used by each of the
|
|
|
237 |
different translation and interface programs.
|
|
|
238 |
Not all options are applicable to all printer environments.
|
|
|
239 |
Table 1 lists the standard
|
|
|
240 |
.I lp
|
|
|
241 |
options, the shell variable settings, and description of the options.
|
|
|
242 |
\" .1C
|
|
|
243 |
.KF
|
|
|
244 |
.sp
|
|
|
245 |
.in 0
|
|
|
246 |
.TS
|
|
|
247 |
center;
|
|
|
248 |
c | c s s | c
|
|
|
249 |
c | c c c | c
|
|
|
250 |
lfCWp-2 | lfCWp-2 cfCWp-2 cfCWp-2 | lp-2w(3i).
|
|
|
251 |
=
|
|
|
252 |
option shell variable action
|
|
|
253 |
\^ name default set \^
|
|
|
254 |
_
|
|
|
255 |
-D DEBUG N 1 turn on debugging mode.
|
|
|
256 |
_
|
|
|
257 |
-H NOHEADER N 1 suppress header page.
|
|
|
258 |
_
|
|
|
259 |
-L LAND N 1 make long page dimension horizontal.
|
|
|
260 |
_
|
|
|
261 |
-M \fImach\fP LPMACHID N \fImach\fP set the source machine name.
|
|
|
262 |
_
|
|
|
263 |
-Q QONLY N 1 do not execute daemon; for debugging.
|
|
|
264 |
_
|
|
|
265 |
-c \fIn\fP COPIES N \fIn\fP number of copies to be printed.
|
|
|
266 |
_
|
|
|
267 |
-d \fIprinter\fP LPDEST U \fIprinter\fP set job destination; override other settings.
|
|
|
268 |
_
|
|
|
269 |
-f \fIfont.pt\fP FONT N \fIfont\fP set font style and point size for printing.
|
|
|
270 |
POINT N \fIpt\fP
|
|
|
271 |
_
|
|
|
272 |
-i \fIn\fP IBIN N \fIn\fP T{
|
|
|
273 |
select input paper tray options.
|
|
|
274 |
The argument given is dependent on the printer type.
|
|
|
275 |
A number can be given to select a particular tray and/or
|
|
|
276 |
.CW simplex
|
|
|
277 |
or
|
|
|
278 |
.CW duplex
|
|
|
279 |
may be used to get single or double sided output, where
|
|
|
280 |
applicable.
|
|
|
281 |
Multiple options should be separated by commas.
|
|
|
282 |
T}
|
|
|
283 |
_
|
|
|
284 |
-k KILLFLAG 0 1 T{
|
|
|
285 |
take non-option arguments as job numbers to be removed from queue.
|
|
|
286 |
T}
|
|
|
287 |
_
|
|
|
288 |
-l \fIn\fP LINES N \fIn\fP T{
|
|
|
289 |
for printed data, the number of lines per logical page.
|
|
|
290 |
T}
|
|
|
291 |
_
|
|
|
292 |
-m \fIf\fP MAG N \fIf\fP T{
|
|
|
293 |
magnify the image by a factor \fIf\fP.
|
|
|
294 |
The factor should be a positive real number.
|
|
|
295 |
T}
|
|
|
296 |
_
|
|
|
297 |
-n \fIn\fP NPAG N \fIn\fP T{
|
|
|
298 |
put \fIn\fP logical pages on a single physical page.
|
|
|
299 |
A simple algorithm is used to pack the pages.
|
|
|
300 |
T}
|
|
|
301 |
_
|
|
|
302 |
-o \fIlist\fP OLIST N \fIlist\fP T{
|
|
|
303 |
print only those pages specified in the list.
|
|
|
304 |
The list may be a sequence of numbers or ranges separated by commas.
|
|
|
305 |
A range is a pair of numbers separated by a hyphen.
|
|
|
306 |
T}
|
|
|
307 |
_
|
|
|
308 |
-p \fIproc\fP LPPROC L \fIproc\fP T{
|
|
|
309 |
use the preprocessor \fIproc\fP instead of the preprocessor given
|
|
|
310 |
in the
|
|
|
311 |
.CW devices
|
|
|
312 |
file for this printer.
|
|
|
313 |
T}
|
|
|
314 |
_
|
|
|
315 |
-q LPQ N 1 T{
|
|
|
316 |
print the status and queue.
|
|
|
317 |
T}
|
|
|
318 |
_
|
|
|
319 |
-r REVERSE L 1 T{
|
|
|
320 |
this toggles the
|
|
|
321 |
.CW REVERSE
|
|
|
322 |
flag, changing whether or not page reversal should occur in preprocessing.
|
|
|
323 |
Page reversal is needed if a printer delivers pages face up.
|
|
|
324 |
The keyword
|
|
|
325 |
.CW reverse
|
|
|
326 |
can be placed in the
|
|
|
327 |
.I lpclass
|
|
|
328 |
field of the
|
|
|
329 |
.CW devices
|
|
|
330 |
file.
|
|
|
331 |
If a document has already been processed this flag has no effect.
|
|
|
332 |
T}
|
|
|
333 |
_
|
|
|
334 |
-u \fIuser\fP LPUSERID U \fIuser\fP T{
|
|
|
335 |
change the user id that appears on the cover page.
|
|
|
336 |
T}
|
|
|
337 |
_
|
|
|
338 |
-x \fIoffset\fP XOFF N \fIoffset\fP T{
|
|
|
339 |
move the image \fIoffset\fP inches to the right.
|
|
|
340 |
A negative \fIoffset\fP will move the image to the left.
|
|
|
341 |
The \fIoffset\fP may be any reasonable real number.
|
|
|
342 |
T}
|
|
|
343 |
_
|
|
|
344 |
-y \fIoffset\fP YOFF N \fIoffset\fP T{
|
|
|
345 |
same as for
|
|
|
346 |
.CW -x
|
|
|
347 |
except a positive offset will move the image down.
|
|
|
348 |
T}
|
|
|
349 |
_
|
|
|
350 |
.T&
|
|
|
351 |
l l cp-2 lp-2 s
|
|
|
352 |
l l cfCWp-2 lp-2 s.
|
|
|
353 |
.vs -2p
|
|
|
354 |
|
|
|
355 |
default setting definition
|
|
|
356 |
N set to the null string (`') initially in \fIlp\fP.
|
|
|
357 |
L set from printer entry in \f(CW\\s-\\n(XPdevices\\s+\\n(XP\fP file.
|
|
|
358 |
U set from the user's environment.
|
|
|
359 |
.vs +2p
|
|
|
360 |
.TE
|
|
|
361 |
.sp
|
|
|
362 |
.ce
|
|
|
363 |
.I "Table 1. Lp Option List"
|
|
|
364 |
.sp
|
|
|
365 |
.ll \\n(LLu
|
|
|
366 |
.KE
|
|
|
367 |
\" .2C
|
|
|
368 |
.NH
|
|
|
369 |
Devices file
|
|
|
370 |
.PP
|
|
|
371 |
The
|
|
|
372 |
.CW devices
|
|
|
373 |
file is found in the spool directory.
|
|
|
374 |
Each line in the file is composed of 12 fields, separated
|
|
|
375 |
by tabs or spaces, that describe the attributes
|
|
|
376 |
of the printer and how it should be serviced.
|
|
|
377 |
Within the
|
|
|
378 |
.CW lp
|
|
|
379 |
command, a shell variable is set for each attribute;
|
|
|
380 |
the following list describes them:
|
|
|
381 |
.IP "\f(CW\s-\n(XPLPDEST\s+\n(XP\fP " 12
|
|
|
382 |
is the name of the device as given to
|
|
|
383 |
.I lp
|
|
|
384 |
with the
|
|
|
385 |
.CW -d
|
|
|
386 |
option
|
|
|
387 |
or as specified by the shell environment variable
|
|
|
388 |
.CW LPDEST
|
|
|
389 |
or as specified by
|
|
|
390 |
the file
|
|
|
391 |
.CW $LPLIB/defdevice .
|
|
|
392 |
This name is used in creating directories and log files that are associated with
|
|
|
393 |
the printers operation.
|
|
|
394 |
.IP "\f(CW\s-\n(XPLOC\s+\n(XP\fP "
|
|
|
395 |
just describes where the printer is physically located.
|
|
|
396 |
.IP "\f(CW\s-\n(XPDEST_HOST\s+\n(XP\fP "
|
|
|
397 |
is the host from which the files are printed.
|
|
|
398 |
Files may be spooled on other machines before being transferred to the
|
|
|
399 |
destination host.
|
|
|
400 |
.IP "\f(CW\s-\n(XPOUT_DEV\s+\n(XP\fP "
|
|
|
401 |
is the physical device name or network address needed by the printer daemon
|
|
|
402 |
to connect to the printer.
|
|
|
403 |
This field depends on the requirements of the daemon and may contain a `\(en'
|
|
|
404 |
if not required.
|
|
|
405 |
.IP "\f(CW\s-\n(XPSPEED\s+\n(XP\fP "
|
|
|
406 |
is the baud rate setting for the port.
|
|
|
407 |
This field depends on the requirements of the daemon and may contain a `\(en'
|
|
|
408 |
if not required.
|
|
|
409 |
.IP "\f(CW\s-\n(XPLPCLASS\s+\n(XP\fP "
|
|
|
410 |
is used to encode minor printer differences.
|
|
|
411 |
The keyword
|
|
|
412 |
.CW reverse
|
|
|
413 |
is used by some of the preprocessors
|
|
|
414 |
to reverse the order the pages are printed to accommodate different output
|
|
|
415 |
trays (either face up or face down).
|
|
|
416 |
The keyword
|
|
|
417 |
.CW nohead
|
|
|
418 |
is used to suppress the header page.
|
|
|
419 |
This is used for special and color printers.
|
|
|
420 |
The keyword
|
|
|
421 |
.CW duplex
|
|
|
422 |
is used to coax double sided output from duplex printers.
|
|
|
423 |
.IP "\f(CW\s-\n(XPLPPROC\s+\n(XP\fP "
|
|
|
424 |
is the command from the
|
|
|
425 |
.CW LPLIB/process
|
|
|
426 |
directory to be used to convert input to a format
|
|
|
427 |
that will be accepted by the device.
|
|
|
428 |
The preprocessor is invoked by the spooler.
|
|
|
429 |
.IP "\f(CW\s-\n(XPSPOOLER\s+\n(XP\fP "
|
|
|
430 |
is the command from the
|
|
|
431 |
.CW LPLIB/spooler
|
|
|
432 |
directory which will select files using the
|
|
|
433 |
.CW SCHED
|
|
|
434 |
command and invoke the
|
|
|
435 |
.CW LPPROC
|
|
|
436 |
command, putting its output
|
|
|
437 |
into the remote spool directory.
|
|
|
438 |
The output is sent directly to the spool directory on the
|
|
|
439 |
destination machine to avoid conflicts when client and
|
|
|
440 |
server machines share spool directories.
|
|
|
441 |
.IP "\f(CW\s-\n(XPSTAT\s+\n(XP\fP "
|
|
|
442 |
is the command from the
|
|
|
443 |
.CW LPLIB/stat
|
|
|
444 |
directory that prints the status of the device and the list of jobs
|
|
|
445 |
waiting on the queue for the device.
|
|
|
446 |
The status information depends on what is available from the printer
|
|
|
447 |
and interface software.
|
|
|
448 |
The queue information should be changed to show information
|
|
|
449 |
useful in tracking down problems.
|
|
|
450 |
The
|
|
|
451 |
.CW SCHED
|
|
|
452 |
command is used to show the jobs in the order
|
|
|
453 |
in which they will be printed.
|
|
|
454 |
.IP "\f(CW\s-\n(XPKILL\s+\n(XP\fP "
|
|
|
455 |
is the command from the
|
|
|
456 |
.CW LPLIB/kill
|
|
|
457 |
that removes jobs from the queue.
|
|
|
458 |
The jobs to be removed are given as arguments to the
|
|
|
459 |
.I lp
|
|
|
460 |
command.
|
|
|
461 |
When possible, it should also abort the currently running job
|
|
|
462 |
if it has to be killed.
|
|
|
463 |
.IP "\f(CW\s-\n(XPDAEMON\s+\n(XP\fP "
|
|
|
464 |
is the command from the
|
|
|
465 |
.CW LPLIB/daemon
|
|
|
466 |
that is meant to run asynchronously to remove
|
|
|
467 |
jobs from the queue.
|
|
|
468 |
Jobs may either be passed on to another host or sent to the
|
|
|
469 |
printing device.
|
|
|
470 |
.I Lp
|
|
|
471 |
always tries to start a daemon process when one is specified.
|
|
|
472 |
.IP "\f(CW\s-\n(XPSCHED\s+\n(XP\fP "
|
|
|
473 |
is the command from the
|
|
|
474 |
.CW LPLIB/sched
|
|
|
475 |
that is used to present the job names to the
|
|
|
476 |
daemon and stat programs
|
|
|
477 |
in some order, e.g., first-in-first-out, smallest first.
|
|
|
478 |
.NH
|
|
|
479 |
Support programs
|
|
|
480 |
.PP
|
|
|
481 |
The following sections describe the basic functions of the programs
|
|
|
482 |
that are found in the subdirectories of
|
|
|
483 |
.CW $LPLIB .
|
|
|
484 |
The programs in a specific directory vary with the
|
|
|
485 |
type of output device or networks that have to be used.
|
|
|
486 |
.NH 2
|
|
|
487 |
Process directory
|
|
|
488 |
.PP
|
|
|
489 |
The
|
|
|
490 |
.CW generic
|
|
|
491 |
preprocessor
|
|
|
492 |
is the default preprocessor for most printers.
|
|
|
493 |
It uses the
|
|
|
494 |
.I file (1)
|
|
|
495 |
command to determine the format of the input file.
|
|
|
496 |
The appropriate preprocessor is then selected to transform the
|
|
|
497 |
file to a format suitable for the printer.
|
|
|
498 |
.PP
|
|
|
499 |
Here is a list of some of the preprocessors and
|
|
|
500 |
a description of their function.
|
|
|
501 |
A complete list of preprocessors and their descriptions can be found in the manual page
|
|
|
502 |
.I lp (8).
|
|
|
503 |
.sp
|
|
|
504 |
.IP \f(CWdvipost\fP 14
|
|
|
505 |
Converts TeX or LaTeX output (\f(CW.dvi\fP files) to PostScript
|
|
|
506 |
.IP \f(CWppost\fP
|
|
|
507 |
Converts UTF text to PostScript.
|
|
|
508 |
The default font is Courier with Lucida fonts filling in
|
|
|
509 |
the remainder of the (available) Unicode character space.
|
|
|
510 |
.IP \f(CWtr2post\fP
|
|
|
511 |
Converts (device independent) troff output for the device type
|
|
|
512 |
.CW utf .
|
|
|
513 |
See
|
|
|
514 |
.CW /sys/lib/troff/font/devutf
|
|
|
515 |
directory for troff font width table descriptions.
|
|
|
516 |
See also the
|
|
|
517 |
.CW /sys/lib/postscript/troff
|
|
|
518 |
directory for mappings of
|
|
|
519 |
troff
|
|
|
520 |
.CW UTF
|
|
|
521 |
character space to PostScript font space.
|
|
|
522 |
.IP \f(CWp9bitpost\fP
|
|
|
523 |
Converts Plan 9 bitmaps (see
|
|
|
524 |
.I bitfile (9.6))
|
|
|
525 |
to PostScript.
|
|
|
526 |
.IP \f(CWg3post\fP
|
|
|
527 |
Converts fax (CCITT-G31 format) to PostScript.
|
|
|
528 |
.IP \f(CWhpost\fP
|
|
|
529 |
Does header page processing and page reversal processing, if
|
|
|
530 |
necessary.
|
|
|
531 |
Page reversal is done here so the header page always comes
|
|
|
532 |
out at the beginning of the job.
|
|
|
533 |
Header page processing is very location-dependent.
|
|
|
534 |
.NH 2
|
|
|
535 |
Spool directory
|
|
|
536 |
.PP
|
|
|
537 |
The
|
|
|
538 |
.CW generic
|
|
|
539 |
spooler is responsible for executing the preprocessor
|
|
|
540 |
and directing its output to a file in the printer's queue.
|
|
|
541 |
An additional file is created containing information such as the system name,
|
|
|
542 |
user id, job number, and number of times this job was attempted.
|
|
|
543 |
.PP
|
|
|
544 |
Certain printer handling programs do not require separate
|
|
|
545 |
preprocessing and spooling.
|
|
|
546 |
For such circumstances a
|
|
|
547 |
.CW nospool
|
|
|
548 |
spooler is available that just executes the preprocessing program.
|
|
|
549 |
The processing and spooling functions are assumed by this program and the output is sent to
|
|
|
550 |
.CW OUT_DEV
|
|
|
551 |
or standard output if
|
|
|
552 |
.CW OUT_DEV
|
|
|
553 |
is '-'.
|
|
|
554 |
.PP
|
|
|
555 |
The
|
|
|
556 |
.CW pcclone
|
|
|
557 |
spooler is used to send print jobs directly to a printer connected
|
|
|
558 |
to a 386 compatible printer port (See
|
|
|
559 |
.I lpt (3)).
|
|
|
560 |
.NH 2
|
|
|
561 |
Stat directory
|
|
|
562 |
.PP
|
|
|
563 |
The function of the shell scripts in the
|
|
|
564 |
.CW stat
|
|
|
565 |
directory is to present status information about the
|
|
|
566 |
printer and its queue.
|
|
|
567 |
When necessary, the
|
|
|
568 |
.CW stat
|
|
|
569 |
scripts may be designed
|
|
|
570 |
to return information about the local queue as well as the remote queue.
|
|
|
571 |
This is not done on Plan 9 because many systems share the same queue directory.
|
|
|
572 |
The scheduler is used to print the queue in the order in which the jobs
|
|
|
573 |
will be executed.
|
|
|
574 |
.NH 2
|
|
|
575 |
Kill directory
|
|
|
576 |
.PP
|
|
|
577 |
The
|
|
|
578 |
.CW kill
|
|
|
579 |
scripts receive command line arguments passed to them by
|
|
|
580 |
.I lp
|
|
|
581 |
and remove the job and id files which match the arguments
|
|
|
582 |
for the particular queue.
|
|
|
583 |
When a job is killed, the generic kill procedure:
|
|
|
584 |
.IP 1)
|
|
|
585 |
kills the daemon for this queue if the job being killed
|
|
|
586 |
is first in the queue,
|
|
|
587 |
.IP 2)
|
|
|
588 |
removes the files associated with the job from the queue,
|
|
|
589 |
.IP 3)
|
|
|
590 |
attempts to restart the daemon.
|
|
|
591 |
.NH 2
|
|
|
592 |
Daemon directory
|
|
|
593 |
.PP
|
|
|
594 |
The
|
|
|
595 |
.CW daemon
|
|
|
596 |
shell scripts are the last to be invoked by
|
|
|
597 |
.I lp
|
|
|
598 |
if the
|
|
|
599 |
.CW -Q
|
|
|
600 |
option has not been given.
|
|
|
601 |
The daemon process is executed asynchronously
|
|
|
602 |
with its standard output and standard error appended to
|
|
|
603 |
the printer log file.
|
|
|
604 |
The log file is described in a subsequent section.
|
|
|
605 |
Because the daemon runs asynchronously, it must
|
|
|
606 |
catch signals that could cause it to terminate abnormally.
|
|
|
607 |
The daemon first checks to see that it is the only one running
|
|
|
608 |
by using the
|
|
|
609 |
.CW LOCK
|
|
|
610 |
program found in the
|
|
|
611 |
.CW /$cputype/bin/aux
|
|
|
612 |
directory.
|
|
|
613 |
The
|
|
|
614 |
.CW LOCK
|
|
|
615 |
command creates a
|
|
|
616 |
.CW LOCK
|
|
|
617 |
file in the printer's queue directory.
|
|
|
618 |
The daemon then executes the scheduler to obtain the name of the
|
|
|
619 |
next job on the queue.
|
|
|
620 |
.PP
|
|
|
621 |
The processing of jobs may entail transfer to another host
|
|
|
622 |
or transmission to a printer.
|
|
|
623 |
The details of this are specific to the individual daemons.
|
|
|
624 |
If a job is processed without error, it is removed from the queue.
|
|
|
625 |
If a job does not succeed, the associated files may be
|
|
|
626 |
moved to a printer specific directory in
|
|
|
627 |
.CW $LPLIB/prob .
|
|
|
628 |
In either case, the daemon can make an entry in the printer's
|
|
|
629 |
log file.
|
|
|
630 |
Before exiting, the daemon should clean up lock files by calling
|
|
|
631 |
.CW UNLOCK .
|
|
|
632 |
.PP
|
|
|
633 |
Several non-standard daemon programs have been designed
|
|
|
634 |
to suit various requirements and whims.
|
|
|
635 |
One such program announces job completion and empty paper trays
|
|
|
636 |
by causing icons to appear in peoples'
|
|
|
637 |
.CW seemail
|
|
|
638 |
window.
|
|
|
639 |
Another, using a voice synthesizer, makes verbal announcements.
|
|
|
640 |
Other daemons may be designed to taste.
|
|
|
641 |
.NH 2
|
|
|
642 |
Sched directory
|
|
|
643 |
.PP
|
|
|
644 |
The scheduler must decide which job files should be executed and
|
|
|
645 |
in what order.
|
|
|
646 |
The most commonly used scheduler program is
|
|
|
647 |
.CW FIFO ,
|
|
|
648 |
which looks like this:
|
|
|
649 |
.P1
|
|
|
650 |
ls -tr $* | sed -n -e 's/.* *//' \e
|
|
|
651 |
-e '/^[0-9][0-9]*\.[1-9][0-9]*$/p'
|
|
|
652 |
.P2
|
|
|
653 |
This lists all the job files in this printer's queue in modification
|
|
|
654 |
time order.
|
|
|
655 |
Jobs entering the queue have a dot (.) prefixed to their name
|
|
|
656 |
to keep the scheduler from selecting them before they are complete.
|
|
|
657 |
.NH
|
|
|
658 |
Where Things Go Wrong
|
|
|
659 |
.PP
|
|
|
660 |
There are four directories where
|
|
|
661 |
.I lp
|
|
|
662 |
writes files.
|
|
|
663 |
On the Plan 9 release these directories may be found
|
|
|
664 |
in a directory on a scratch filesystem that is not
|
|
|
665 |
backed-up.
|
|
|
666 |
This directory is
|
|
|
667 |
.CW /n/emelieother/lp .
|
|
|
668 |
It is built on top of a file system
|
|
|
669 |
.CW other
|
|
|
670 |
that is mounted on the file server
|
|
|
671 |
.CW emelie .
|
|
|
672 |
The four directories in
|
|
|
673 |
this scratch directory
|
|
|
674 |
are
|
|
|
675 |
.CW log ,
|
|
|
676 |
.CW prob ,
|
|
|
677 |
.CW queue ,
|
|
|
678 |
and
|
|
|
679 |
.CW tmp .
|
|
|
680 |
.I Lp
|
|
|
681 |
binds (see
|
|
|
682 |
.I bind (1))
|
|
|
683 |
the first three into the directory
|
|
|
684 |
.CW /sys/lib/lp
|
|
|
685 |
for its processes and their children.
|
|
|
686 |
The
|
|
|
687 |
.CW tmp
|
|
|
688 |
directory is bound to the
|
|
|
689 |
.CW /tmp
|
|
|
690 |
directory so that the lp daemons, which run as user `none',
|
|
|
691 |
may write into this directory.
|
|
|
692 |
.PP
|
|
|
693 |
On any new installation, it is important that these directories
|
|
|
694 |
be set up and that the
|
|
|
695 |
.I /rc/bin/lp
|
|
|
696 |
command be editted to reflect the change.
|
|
|
697 |
If you do not have a scratch filesystem for these directories,
|
|
|
698 |
create the four directories
|
|
|
699 |
.CW log ,
|
|
|
700 |
.CW prob ,
|
|
|
701 |
.CW queue ,
|
|
|
702 |
and
|
|
|
703 |
.CW tmp
|
|
|
704 |
in
|
|
|
705 |
.CW $LPLIB
|
|
|
706 |
.CW (/sys/lib/lp)
|
|
|
707 |
so that they are writable by anyone.
|
|
|
708 |
.NH 2
|
|
|
709 |
Log directory
|
|
|
710 |
.PP
|
|
|
711 |
The log files for a particular
|
|
|
712 |
.I printer
|
|
|
713 |
appear in a subdirectory of the spool directory
|
|
|
714 |
\f(CWlog\fP/\fIprinter\fP.
|
|
|
715 |
There are currently two types of log files.
|
|
|
716 |
One is for the daemon to log errors and successful completions
|
|
|
717 |
of jobs.
|
|
|
718 |
These are named
|
|
|
719 |
.I printer.day
|
|
|
720 |
where
|
|
|
721 |
.I day
|
|
|
722 |
is the three letter abbreviation for the day of the week.
|
|
|
723 |
These are overwritten once a week to avoid the need for regular
|
|
|
724 |
cleanup.
|
|
|
725 |
The other type of log file contains the status of the printer and
|
|
|
726 |
is written by the program that communicates with the printer itself.
|
|
|
727 |
These are named
|
|
|
728 |
\fIprinter\fP.\f(CWst\fP.
|
|
|
729 |
These are overwritten with each new job and are saved in the
|
|
|
730 |
.CW $LPLIB/prob
|
|
|
731 |
directory along with the job under circumstances described below.
|
|
|
732 |
When a printer does not appear to be functioning these files are the
|
|
|
733 |
place to look first.
|
|
|
734 |
.NH 2
|
|
|
735 |
Prob directory
|
|
|
736 |
.PP
|
|
|
737 |
When a job fails to produce output,
|
|
|
738 |
the log files should be checked for any obvious problems.
|
|
|
739 |
If none can be found, a directory with full read and write permissions
|
|
|
740 |
should be created with the name of the printer in the
|
|
|
741 |
.CW $LPLIB/prob
|
|
|
742 |
directory.
|
|
|
743 |
Subsequent failure of a job will cause the daemon to leave a
|
|
|
744 |
copy of the job and the printer communication log in
|
|
|
745 |
\f(CW$LPLIB/prob/\fP\fIprinter\fP
|
|
|
746 |
directory.
|
|
|
747 |
It is common for a printer to enter states from which
|
|
|
748 |
it cannot be rescued except by manually cycling the power on the printer.
|
|
|
749 |
After this is done the print daemon should recover by itself
|
|
|
750 |
(give it a minute).
|
|
|
751 |
If it does not recover, remove the
|
|
|
752 |
.CW LOCK
|
|
|
753 |
file from the printer's spool directory to kill the daemon.
|
|
|
754 |
The daemon will have to be restarted by sending another job
|
|
|
755 |
to the printer.
|
|
|
756 |
For PostScript printers just use:
|
|
|
757 |
.P1
|
|
|
758 |
echo '%!PS' | lp
|
|
|
759 |
.P2
|
|
|
760 |
.NH 2
|
|
|
761 |
Repairing Stuck Daemons
|
|
|
762 |
.PP
|
|
|
763 |
There are conditions that occur which are not handled
|
|
|
764 |
by the daemons.
|
|
|
765 |
One such problem can only be described as the printer entering a
|
|
|
766 |
comatose state.
|
|
|
767 |
The printer does not respond to any messages sent to it.
|
|
|
768 |
The daemon should recover from the reset and an error message
|
|
|
769 |
will appear in the log files.
|
|
|
770 |
If all else fails, one can kill the first job in the queue
|
|
|
771 |
or remove the
|
|
|
772 |
.CW LOCK
|
|
|
773 |
file from the queue directory.
|
|
|
774 |
This will kill the daemon, which will have to be restarted.
|
|
|
775 |
.NH
|
|
|
776 |
Interprocessor Communication
|
|
|
777 |
.PP
|
|
|
778 |
A Plan 9 CPU server can be set up as a printer's spooling host.
|
|
|
779 |
That is, the machine where jobs are spooled and from which those jobs
|
|
|
780 |
are sent directly to the printer.
|
|
|
781 |
To do this, the CPU must listen on TCP port 515 which is the well known
|
|
|
782 |
port for the BSD line printer daemon.
|
|
|
783 |
The file
|
|
|
784 |
.CW /rc/bin/service/tcp515
|
|
|
785 |
is executed when a call comes in on that port.
|
|
|
786 |
The Plan 9
|
|
|
787 |
.CW lpdaemon
|
|
|
788 |
will accept jobs sent from BSD LPR/LPD systems.
|
|
|
789 |
The
|
|
|
790 |
.CW /$cputype/bin/aux/lpdaemon
|
|
|
791 |
command is executed from the service call and it accepts print jobs, requests for status,
|
|
|
792 |
and requests to kill jobs.
|
|
|
793 |
The command
|
|
|
794 |
.CW /$cputype/bin/aux/lpsend
|
|
|
795 |
is used to send jobs
|
|
|
796 |
to other Plan 9 machines and is usually called from
|
|
|
797 |
within a spooler or daemon script.
|
|
|
798 |
The command
|
|
|
799 |
.CW /$cputype/bin/aux/lpdsend
|
|
|
800 |
is used to send jobs
|
|
|
801 |
to machines and printers that use the BSD LPR/LPD protocol and is also usually called from
|
|
|
802 |
within a spooler or daemon script.
|
|
|
803 |
.NH
|
|
|
804 |
Acknowledgements
|
|
|
805 |
.PP
|
|
|
806 |
Special thanks to Rich Drechsler for supplying and maintaining most of
|
|
|
807 |
the PostScript translation and interface programs,
|
|
|
808 |
without which
|
|
|
809 |
.I lp
|
|
|
810 |
would be an empty shell.
|
|
|
811 |
Tomas Rokicki provided the
|
|
|
812 |
TeX
|
|
|
813 |
to PostScript
|
|
|
814 |
translation program.
|
|
|
815 |
.NH
|
|
|
816 |
References
|
|
|
817 |
.LP
|
|
|
818 |
[Camp86] Ralph Campbell,
|
|
|
819 |
``4.3BSD Line Printer Spooler Manual'', UNIX System Manager's Manual,
|
|
|
820 |
May, 1986, Berkeley, CA
|
|
|
821 |
.br
|
|
|
822 |
[RFC1179] Request for Comments: 1179, Line Printer Daemon Protocol, Aug 1990
|
|
|
823 |
.br
|
|
|
824 |
[Sys5] System V manual, date unknown
|