File: printrc.5

package info (click to toggle)
pdq 2.2.1-7
  • links: PTS
  • area: main
  • in suites: woody
  • size: 936 kB
  • ctags: 576
  • sloc: ansic: 8,884; makefile: 467; sh: 175; perl: 142
file content (490 lines) | stat: -rw-r--r-- 15,503 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
.TH PRINTRC 5 "JANUARY 2000" Linux "pdq printing manuals"
.SH NAME
printrc \- Printer resource database
.SH SYNOPSIS
.B printrc
.SH DESCRIPTION
This document describes the structure of the printrc files.  The files
.IR /etc/pdq/printrc " and " "~/.printrc" 
are parsed, if they exist, and solely determine the print resources
available, although each printrc file may include other rc files.
.SH LEXICAL STRUCTURE
Each printrc file consists of a series of blocks separated by whitespace.
In this context, a block is defined to be either a simple word constructed
of 
.I [A-Z] [a-z] [0-9]  _ . / : @ - 
or any characters enclosed in delimiters
.IR "{} [] () '' """"" . 
Delimiters may be included in the block by escaping them
with \fI\\\fR.  Whitespace is defined to be spaces, tabs, newlines, any of 
.I # ; , = 
and characters between 
.I # 
and newline.
.SH TOP-LEVEL KEYWORDS
Keywords defined in this section may be included anywhere in the rc file.
Some items (such as printers, drivers, and interfaces) look for other sets
of keywords within their description block.  Those cases are documented in
subsequent sections.  Repeated occurrences of keywords overwrite earlier
definitions, except for uniquely named printers, drivers, and interfaces.
.IP "include \fIpattern"
All files matching 
.I pattern
are opened and parsed as printrc files.  If 
any matched file cannot be opened, or if no files match 
.IR pattern ,
parsing stops with an error.   Note that 
.I pattern
is first tilde expanded, then globbed.
.IP "try_include \fIpattern"
All files matching 
.I pattern
are opened and parsed as printrc files.  If 
any matched file cannot be opened, or if no files match 
.IR pattern ,
parsing continues without errors.  Note that 
.IR pattern
is first tilde expanded, then globbed.  Files beginning in
.BR ". " and
ending in
.BR "~ " are 
ignored, as they are probably editor backup files.
.IP "printer \fIname block"
A printer named 
.I name
is defined in 
.IR block . 
Structure of 
.I block is
described later in this file.
.IP "driver \fIname block"
A driver named 
.I name
is defined in 
.IR block . 
Structure of 
.I block
is described later in this file.
.IP "interface \fIname block"
An interface named 
.Iname
is defined in 
.IR block .  
Structure of 
.I block
is described later in this file.
.IP "default_printer \fIprinter"
The printer named 
.I printer
will be used as the default printer.  There is no default.
.IP "job_dir \fIdirectory"
The job work directory will be set to 
.IR directory . 
Note that 
.I directory
is tilde-expanded.  The default is 
.IR "~/.printjobs" .
.IP "interface_command_path \fIpath"
The environment variables 
.B PATH 
will be set to 
.I path
for all scripts defined in the interfaces.  The default is 
.IR "bin:/usr/bin:/usr/local/bin" .
.IP "driver_command_path \fIpath"
The environment variables 
.B PATH 
will be set to 
.I path
for all scripts
defined in the drivers.  The default is 
.IR "bin:/usr/bin:/usr/local/bin" .
.IP "max_send_tries \fIi"
The interface script 
.I send_exec 
will be executed at most 
.I i 
times before 
the job aborts.  The default is 
.IR 30 .
.IP "delay_between_tries \fIi"
If the interface script 
.I send_exec 
fails, 
.I i
seconds should pass before
re-executing the script.  The default is 
.IR 10 .
.IP "job_history_duration \fIi"
Any information in the job directory (
.I job_dir
) will not be deleted until
it is at least 
.I i
seconds old.  The default is 
.I 259200
(3 days).
.SH PRINTER KEYWORDS
.IP "driver \fIname"
The block 
.I name
is taken to be the name of the driver for this printer.  The driver must
be defined elsewhere in the printrc files.
.IP "interface \fIname"
The block 
.I name
is taken to be the name of the interface for this printer.
The interface must be defined elsewhere in the printrc files.
.IP "driver_opts \fIblock"
Options for the driver are contained in 
.IR block ,
which consists of option names separated by whitespace.
.IP "driver_args \fIblock"
Arguments for the driver are contained in 
.IR block ,
which consists of pairs of argument name and argument value separated by
whitespace.
.IP "interface_opts \fIblock"
Options for the interface are contained in 
.IR block ,
which consists of option names separated by whitespace.
.IP "interface_args \fIblock"
Arguments for the interface are contained in 
.IR block ,
which consists of pairs of argument name and argument value separated by
whitespace.
.IP "location \fIdescription"
The block 
.I description
is taken to be the descriptive location of 
the printer.  This keyword should not affect functionality.
.IP "model \fIdescription"
The block 
.I description
is taken to be the descriptive model name  of 
the printer.  This keyword should not affect functionality.
.IP delete
This printer and all prior declarations of the same name are ignored.  This
keyword is provided so that ordinary users may remove entries for printers
defined in global resource files.
.SH DRIVER KEYWORDS
.IP "filetype_exec \fIscript"
The argument 
.I script
is taken to be a shell script.  If the interpreter
command is not specified with a shebang, it is taken to be 
.IR "/bin/sh" .  
The function of the script is to determine the type of the file named in the
environment variable 
.BR INPUT .  
A description of the filetype should be printed to 
.IR stdout , 
and should be less than 1024 bytes.  Any messages printed to 
.I sterr 
will be logged.  If the exit code is not zero the print job will abort.
The default is 
.IR file .
.IP "verify_exec \fIscript"
The argument 
.I script
is taken to be a shell script.  If the interpreter command is not 
specified with a shebang, it is taken to be 
.IR "/bin/sh" .  
The function of the script is to determine whether or not the system has 
capabilities required by this component.  If the script exits with
nonzero status, the component is taken to be unavailable.  Informative 
failure messages should be sent to either 
.I stdout 
or 
.IR stderr .
The default is not to execute anything.
.IP "requires \fIfiles"
The argument 
.I files
is taken to be a whitespace-separated list of program names required by this 
component.  Each item in the list must be found in the relevant path, and 
have executable permissions.  Otherwise the component is taken to be 
unavailable.
.IP "filter_exec \fIscript"
The argument 
.I script
is taken to be a shell script.  If the interpreter command is not specified 
with a shebang, it is taken to be 
.IR "/bin/sh" .  
The function of the script is to filter the file named by environment variable
.BR INPUT .  
The filtered output should be written to the file named by environment 
variable 
.BR OUTPUT .
Note that other scripts are used to convert into an appropriate language.
This script should only be used to finalize the document before sending it 
to the printer.  If the script exits with nonzero status, the job is aborted.
Informative failure messages should be sent to either 
.I stdout 
or 
.IR stderr .
This script also has access to all environment variables set by options and 
arguments for this component. The default is
.I "ln -s "
.BR "$OUTPUT $INPUT" .
.IP "language_driver \fIblock"
A language-driver named 
.I name
is defined in 
.IR block .  
Structure of 
.I block
is described later in this file.
.IP "option \fIblock"
An option for this component is defined in 
.IR block .  
Structure of 
.I block 
is described later in this file.
.IP "default_options \fIlist"
The argument 
.I list
is taken to be a whitespace-separated list of default
options for this component.  
.IP "argument \fIblock"
An argument for this component is defined in 
.IR block .  
Structure of 
.I block
is described later in this file.
.IP "required_args \fIlist"
The argument 
.I list
is taken to be a whitespace-separated list of
names of arguments required for this component.  If required arguments are
not specified in a printer definition or passed through command-line
options, the component will be unavailable.
.IP "help \fItext"
The argument 
.I text
should describe the driver and list printers that are known to work.  
Newlines, tabs, and spaces all get compressed to a
single space.  Tabs and newlines may be added by using \\n and \\t.  The
.I help
keyword does not affect functionality.
.SH LANGUAGE-DRIVER KEYWORDS
.IP "convert_exec \fIscript"
The argument 
.Iscript
is taken to be a shell script.  If the interpreter
command is not specified with a shebang, it is taken to be 
.IR "/bin/sh" .  
The function of the script is to convert the file named by environment variable
.B INPUT 
into a form suitable for printing (or into a form expected by the
.I filter_exec 
script defined for the driver).  The converted output should 
be written to the file named by environment variable 
.BR OUTPUT . 
If the script exits with nonzero status, the job is aborted.
Informative failure messages should be sent to either 
.I stdout 
or 
.IR stderr .
This script also has access to all environment variables set by
options for this component, as well as those set by options and
arguments for the driver in which it is defined. The default is
.I "ln -s "
.BR "$OUTPUT $INPUT " .
.IP "filetype_regx \fIpattern"
If 
.I pattern
matches any part of the filetype, as returned by the 
filetype_exec script defined in the driver, then this language driver
will be used to convert the print job.  The language drivers are tried
in the sequence they are defined, and the first match selects a language
driver.
.SH INTERFACE KEYWORDS
.IP "verify_exec \fIscript"
The argument 
.I script
is taken to be a shell script.  If the interpreter
command is not specified with a shebang, it is taken to be 
.IR "/bin/sh" . 
The function of the script is to determine whether or not the system has 
capabilities required by this component.  If the script exits with
nonzero status, the component is taken to be unavailable.  Informative 
failure messages should be sent to either 
.I stdout 
or 
.IR stderr .
The default is not to execute anything.
.IP "requires \fIfiles"
The argument 
.I files
is taken to be a whitespace-separated list of program names required
by this component.  Each item in the list must be found in the relevant
path, and have executable permissions.  Otherwise the component is taken
to be unavailable.
.IP "send_exec \fIscript"
The argument 
.Iscript
is taken to be a shell script.  If the interpreter command is not
specified with a shebang, it is taken to be
.IR "/bin/sh" .  
The function of the script is to send the file named by environment variable 
.B INPUT 
to the printer.  If the script exits with nonzero status, the script will be 
re-executed at intervals of 
.I delay_between_tries 
seconds, up to 
.I max_send_tries 
times.  Informative failure messages should be sent to either 
.I stdout 
or 
.IR stderr .
This script also has access to all environment variables set by
options and arguments for this component.  
There is no default value for 
.IR send_exec .
Specification of this script is required.
.IP "cancel_exec \fIscript"
The argument 
.Iscript
is taken to be a shell script.  If the interpreter command is not
specified with a shebang, it is taken to be
.IR "/bin/sh" .  
The function of the script is to cancel a printing job.  If the
.I send_exec
script is still executing, it will be sent a
.B SIG_TERM
signal and 
.I cancel_exec
will immediately be executed.  The exit code of the script is ignored.
This script also has access to all environment variables set by
options and arguments for this component.
There is no default value for 
.IR cancel_exec .
.IP "status_exec \fIscript"
The argument 
.Iscript
is taken to be a shell script.  If the interpreter command is not
specified with a shebang, it is taken to be
.IR "/bin/sh" .  
The function of the script is to print the status of the printer.
This script also has access to all environment variables set by
options and arguments for this component.
There is no default value for 
.IR status_exec .
.IP "option \fIblock"
An option for this component is defined in 
.IR block .  
Structure of 
.I block
is described later in this file.
.IP "default_options \fIlist"
The argument 
.I list
is taken to be a whitespace-separated list of default options for this 
component.  
.IP "argument \fIblock"
An argument for this component is defined in 
.IR block . 
Structure of 
.I block
is described later in this file.
.IP "required_args \fIlist"
The argument 
.I list
is taken to be a whitespace-separated list of names of arguments required
for this component.  If all arguments are not available either through
printrc specification or command-line specification, the component will
be unavailable.
.IP "help \fItext"
The argument 
.I text
should describe the interface.
Newlines, tabs, and spaces all get compressed to a
single space.  Tabs and newlines may be added by using \\n and \\t.  The
.I help
keyword does not affect functionality.
.SH ARGUMENT KEYWORDS
.IP "var \fIname"
The environment variable controlled by this argument is 
.IR name .
.IP "desc \fItext"
A very short description of the argument should be provided in 
.IR text .
.IP "def_value \fIstring"
If this argument is not specified, the default value will be 
.IR string .
.IP "help \fItext"
A short description of the argument should be provided in 
.IR text .
Newlines, tabs, and spaces all get compressed to a
single space.  Tabs and newlines may be added by using \\n and \\t.
The contents of
.I text
will be displayed in popup tooltips of utilities that allow graphical
selection of printer arguments.
.SH OPTION KEYWORDS
.IP "var \fIname"
The environment variable controlled by this option is 
.IR name .
.IP "choice \fIname block"
A choice named
.I name
is described in
.IR block .
The choices are used to control the values of environment variable
specified by
.IR var ,
and 
.I name
is used to select the option from the command line.  
.IP "desc \fItext"
A very short description of the option should be provided in 
.IR text .
.IP "default_choice \fIname"
If no choice for this option is specified, the choice
.I name
will be used.  If 
.I default_choice
is not specified, the first choice listed is taken to be the default.
.SH CHOICE KEYWORDS
.IP "desc \fItext"
A very short description of the option should be provided in 
.IR text .
.IP "value \fIstring"
If this choice is selected, the environment variable 
.IR var ,
which is given as an
.I option
keyword, will be 
.IR string .
.IP "help \fItext"
A short description of the choice should be provided in 
.IR text .
Newlines, tabs, and spaces all get compressed to a
single space.  Tabs and newlines may be added by using \\n and \\t.
The contents of
.I text
will be displayed in popup tooltips of utilities that allow graphical
selection of printer options.
.SH STATUS MESSAGES
The 
.BR convert_exec ", " filter_exec ", " filetype_exec ", " 
and
.BR "send_exec " scripts
may also set the
status of the printjob by writing to the file named by environment
variable 
.BR STATUS .  
The status will be set to the last nontrivial line in this file, not
to exceed 1023 characters.
Note that IO buffering may cause delays in status updates.  The status
file almost always overrides internal status messages.

.SH BUGS
Some interpreters (such as perl) have different locations on different
systems.  There should be a means of defining interpreter locations so that
the shebang line of the exec scripts can be fixed before execution.
.SH AUTHOR
Jacob A. Langford <langford@uiuc.edu>
.SH SEE ALSO
pdq(1), xpdq(1), pdqstat(1)