This file is indexed.

/usr/share/doc/lprng-doc/LPRng-Reference-Multipart/x3772.htm is in lprng-doc 3.8.A~rc2-3.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for HTML5 for Linux version 5.2.0">
  <title>Job Options and the Z Control File Entry</title>
  <meta name="GENERATOR" content=
  "Modular DocBook HTML Stylesheet Version 1.79">
  <link rel="HOME" title=" LPRng Reference Manual" href=
  "index.htm">
  <link rel="UP" title="Print Spooling Tutorial " href=
  "tutorial.htm">
  <link rel="PREVIOUS" title="Routing Jobs To Print Queues" href=
  "x3699.htm">
  <link rel="NEXT" title="Interfacing to Non-LPRng Spoolers" href=
  "x3897.htm">
</head>
<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF"
vlink="#840084" alink="#0000FF">
  <div class="NAVHEADER">
    <table summary="Header navigation table" width="100%" border=
    "0" cellpadding="0" cellspacing="0">
      <tr>
        <th colspan="3" align="center">LPRng Reference Manual: 24
        Sep 2004 (For LPRng-3.8.28)</th>
      </tr>
      <tr>
        <td width="10%" align="left" valign="bottom"><a href=
        "x3699.htm" accesskey="P">Prev</a></td>
        <td width="80%" align="center" valign="bottom">Chapter 4.
        Print Spooling Tutorial</td>
        <td width="10%" align="right" valign="bottom"><a href=
        "x3897.htm" accesskey="N">Next</a></td>
      </tr>
    </table>
    <hr align="left" width="100%">
  </div>
  <div class="SECT1">
    <h1 class="SECT1"><a name="AEN3772" id="AEN3772">4.19. Job
    Options and the Z Control File Entry</a></h1>
    <p>Many printers have special capabilities such as printing in
    landscape mode, duplex printing, binding, or stapling. These
    capabilities are usually invoked or enabled by the print
    spooler sending special printer control commands to the printer
    based on values it finds in the control file. The <b class=
    "APPLICATION">LPRng</b> print spooler uses the <tt class=
    "LITERAL">Z</tt> line in the control file to specify these
    options, while other print spoolers such as the Sun
    Microsystems Solaris <b class="APPLICATION">lp</b> system pass
    them on the <tt class="LITERAL">S</tt> line.</p>
    <p>Job formatting options are specified using the <tt class=
    "COMMAND">lpr -Z</tt> option. The <b class=
    "APPLICATION">lpr</b> program concatenates the <tt class=
    "LITERAL">-Z</tt> options and puts them in the control file as
    a single <tt class="LITERAL">Z</tt> line. For example:</p>
    <div class="INFORMALEXAMPLE">
      <a name="AEN3784" id="AEN3784"></a>
      <pre class="SCREEN"><samp class=
      "PROMPT">h4: {289} % </samp><kbd class=
      "USERINPUT">lpc stop</kbd>
Printer: lp@h4
lp@h4.private: stopped
<samp class="PROMPT">h4: {290} % </samp><kbd class=
"USERINPUT">lpr -Zthis -Zthat /tmp/hi</kbd>
<samp class="PROMPT">h4: {291} % </samp><kbd class=
"USERINPUT">cat /var/spool/lp/cf*</kbd>
Hh4.private
Ppapowell
J/tmp/hi
CA
Lpapowell
Zthis,that
Apapowell@h4+115
D2000-05-05-10:05:41.351
Qlp
N/tmp/hi
fdfA115h4.private
UdfA115h4.private</pre>
    </div>
    <p>As we see, the <tt class="LITERAL">Z</tt> options have been
    put into the control file on the <tt class="LITERAL">Z</tt>
    line. The <tt class="LITERAL">Z</tt> option values are passed
    to filters on the command line as the <tt class=
    "LITERAL">-Z</tt> command line option. These values are used by
    the <b class="APPLICATION">ifhp</b> filter to determine what
    control commands to send to the printer and how to format the
    print job output. Because each printer is different and
    supports a different set of capabilities it is impossible to
    have a set of job options supported across all printers. The
    following are supported by the <b class="APPLICATION">ifhp</b>
    configuration where possible. Many of these options rely on the
    printer supporting PostScript or having the appropriate PCL
    commands to do the indicated operation.</p>
    <ul>
      <li>
        <p>-Zlandscape -Zportrait - select landscape or portrait
        orientation.</p>
      </li>
      <li>
        <p>-Zduplex -Zsimplex - select duplex (both sides of a
        page) or simplex (single side of a page) printing.</p>
      </li>
      <li>
        <p>-Zletter -Zlegal -Zledger -Za4 -Za5 -Zenvelope
        -Ztransparency - select a paper size</p>
      </li>
      <li>
        <p>-Zinupper -Zinmiddle -Zinlower - select input media from
        the appropriate input tray</p>
      </li>
      <li>
        <p>-Zmanual - select input from the manual feed</p>
      </li>
    </ul>
    <div class="SECT2">
      <h2 class="SECT2"><a name="AEN3810" id="AEN3810">4.19.1.
      Setting Job Options Using the Printcap</a></h2>
      <p>An alternative to this method of using <b class=
      "APPLICATION">lpr</b> and the <tt class="LITERAL">-Z</tt>
      option is to define a set of spool queues which will put the
      necessary options into the job control file. This can be done
      by the <b class="APPLICATION">lpr</b> program when the job is
      generated, or by the <b class="APPLICATION">lpd</b> spooler
      when the job is processed. The The options specified by the
      <tt class="LITERAL">:prefix_z</tt>, <tt class=
      "LITERAL">:append_z</tt>, and <tt class=
      "LITERAL">:delete_z</tt> are prefixed, appended, or deleted
      from the current set of <tt class="LITERAL">Z</tt> control
      file options by the <b class="APPLICATION">lpr</b> program
      when the job is submitted and they are specified in the
      printcap for the queue, or by the <b class=
      "APPLICATION">lpd</b> spooler when the job is submitted to
      the queue. We can use this capapbility to configure print
      queues to a desired set of <tt class="LITERAL">Z</tt> options
      into the control file. For example:</p>
      <div class="INFORMALEXAMPLE">
        <a name="AEN3824" id="AEN3824"></a>
        <pre class="SCREEN">landscape:lp=%P@server
landscape:server:tc=.common
  :lp=raw@server:append_z=landscape:delete_z=portrait
raw:server:tc=.common:lp=....
  :filter=/usr/local/libexec/filters/ifhp
.common:sd=/var/spool/lpd/%P</pre>
      </div>
      <p>When a job is sent to the <tt class=
      "LITERAL">landscape</tt> queue, the control file <tt class=
      "LITERAL">Z</tt> line will have the <tt class=
      "LITERAL">portrait</tt> option removed and the <tt class=
      "LITERAL">landscape</tt> option appended. The <tt class=
      "LITERAL">:delete_z</tt> values are glob patterns and options
      that match are removed from the option list. Options are
      assumed to be separated by commas or semicolons in the option
      list.</p>
    </div>
    <div class="SECT2">
      <h2 class="SECT2"><a name="AEN3832" id="AEN3832">4.19.2.
      Converting SystemV Options to LPRng Options</a></h2>
      <p>On some SystemV <b class="APPLICATION">lp</b> print
      spoolers, the <tt class="COMMAND">lp -o option</tt>, puts the
      option information into the control file <tt class=
      "LITERAL">S</tt> line, and on other systems on the puts the
      option information into the control file <tt class=
      "LITERAL">O</tt> line. To convert these options to <b class=
      "APPLICATION">LPRng</b> <tt class="LITERAL">Z</tt> options
      use the <tt class=
      "LITERAL">:prefix_option_to_option=from,from... to</tt>
      facility to prefix the <span class="emphasis"><i class=
      "EMPHASIS">from</i></span> control file lines to the
      <span class="emphasis"><i class="EMPHASIS">to</i></span>
      control file line. For example:</p>
      <div class="INFORMALEXAMPLE">
        <a name="AEN3844" id="AEN3844"></a>
        <pre class="SCREEN">
        # System V to LPRng - S and O to Z options
convert:server:tc=.common
  :lp=raw@server:prefix_option_to_option=S,O Z
# LPRng to System V O options
convert:server:tc=.common
    :lp=raw@server:prefix_option_to_option=Z O</pre>
      </div>
    </div>
    <div class="SECT2">
      <h2 class="SECT2"><a name="AEN3846" id="AEN3846">4.19.3.
      Selecting a Single Option - Muliple Queues</a></h2>
      <p>Here is an example of how you can set up queues that will
      append the appropriate <tt class="LITERAL">Z</tt> option to
      select landscape mode, do duplex printing, or select legal or
      ledger size paper:</p>
      <div class="INFORMALEXAMPLE">
        <a name="AEN3850" id="AEN3850"></a>
        <pre class="SCREEN">landscape:lp=%P@server
landscape:server:tc=.common
    :lp=raw@server:append_z=landscape
duplex:lp=%P@server
duplex:server:tc=.common
    :lp=raw@server:append_z=duplex
ledger:lp=%P@server
ledger:server:tc=.common
    :lp=raw@server:append_z=ledger
legal:lp=%P@server
legal:server:tc=.common
    :lp=raw@server:append_z=legal
raw:server:tc=.common:lp=....
  :filter=/usr/local/libexec/filters/ifhp
.common:sd=/var/spool/lpd/%P</pre>
      </div>
      <p>The problem with this method is that for each option we
      need to define a queue whose only purpose is to append the
      appropriate option and then forward this to the main print
      queue.</p>
    </div>
    <div class="SECT2">
      <h2 class="SECT2"><a name="INCOMINGCONTROLFILTER" id=
      "INCOMINGCONTROLFILTER">4.19.4. Selecting Multiple Options -
      Single Queue</a></h2>
      <p>In the previous section, we showed how to set up a queue
      that would append a single option to the control file
      <tt class="LITERAL">Z</tt> line. If we want to have
      combinations of option options specified by the printer name
      then we will have to create a large number of queues each
      with a different set of options and each appending a
      different set of values. The problem becomes compounded when
      we have many printers, each of which requires these
      options.</p>
      <p>The solution to this problem originated with the <b class=
      "APPLICATION">apsfilter</b> program written by Andreas Klemm
      and Thomas Bueschgens. They made the observeration that if we
      know the name of the print queue then we can use this name to
      select options for the printer. The <b class=
      "APPLICATION">LPRng</b> provides this functionality by using
      wildcard queues and <span class="emphasis"><i class=
      "EMPHASIS">editing</i></span> or <span class=
      "emphasis"><i class="EMPHASIS">filtering</i></span> the
      control file when the job is submitted to the spool
      queue.</p>
      <p>The <tt class="LITERAL">incoming_control_filter=/path</tt>
      filter processes the incoming job control or job ticket file.
      It can be used to values in the job ticket of incoming jobs.
      It reads the control file on its <acronym class=
      "ACRONYM">STDIN</acronym> and writes the new or modified
      values on <acronym class="ACRONYM">STDOUT</acronym>. A 0 exit
      code value causes normal processing of the job, <tt class=
      "LITERAL">JHOLD</tt> will hold the job, and any other value
      will cause the job to be discarded. The <tt class=
      "LITERAL">incoming_control_filter</tt> filter can modify
      priority or other job options, including using the <tt class=
      "LITERAL">move=</tt> field to cause a job to be redirect to
      another spool queue or printer. Only changes to the jobs
      options need to be generated by the <tt class=
      "LITERAL">incoming_control_filter=/path</tt> filter.</p>
      <p>The input and output have the format:</p>
      <div class="INFORMALEXAMPLE">
        <a name="AEN3871" id="AEN3871"></a>
        <pre class="SCREEN">INPUT:
 X&lt;option&gt;       - option from control file
 X=&lt;option&gt;      - alternative option format
 key=&lt;option&gt;    - spooler option
 X==&lt;option&gt;     - option starting with = sign

OUTPUT:
 X                     - delete option or value
 X=                    - delete option or value
 X&lt;option&gt;       - set option value
 X=&lt;option&gt;      - set option value
 key=&lt;option&gt;    - set value of 'key' to option
 key=                  - delete option or value</pre>
      </div>
      <p>In addition to modifying job options, the contents of the
      jobs data files can be modified or the data files removed.
      Any data files with a 0 length will be removed from the job.
      If all of the data files have a 0 length then the job will be
      discarded. Modification of job options may have unforseen
      effects on</p>
      <p>The following shows how we can set up a single queue that
      will allow various combinations of options to be selected by
      the format of the queue name:</p>
      <div class="INFORMALEXAMPLE">
        <a name="AEN3875" id="AEN3875"></a>
        <pre class="SCREEN"># for clients
pr|pr_*:lp=%Q@server
# for server
pr|pr_*:server
  :tc=.common:lp=....
  :incoming_control_filter=/usr/local/libexec/filters/update_z
  :filter=/usr/local/libexec/filters/ifhp
.common:sd=/var/spool/lpd/%P</pre>
      </div>
      <p>The <tt class="LITERAL">pr</tt> and <tt class=
      "LITERAL">pr_*</tt> aliases will match printer <tt class=
      "LITERAL">pr</tt> all print queue names starting with
      <tt class="LITERAL">pr_</tt>. We can then use various
      suffixes to select job options. The following filter program
      uses the <tt class="LITERAL">_landscape</tt>, <tt class=
      "LITERAL">_legal</tt>, and <tt class="LITERAL">_ledger</tt>
      suffixes to set the corresponding option in the <tt class=
      "LITERAL">Z</tt> file. This program and other are available
      in the <b class="APPLICATION">LPRng</b> distribution in the
      <tt class="FILENAME">UTILS</tt> directory. You should note
      that additional options can be specified as desired.</p>
      <div class="INFORMALEXAMPLE">
        <a name="AEN3888" id="AEN3888"></a>
        <pre class="SCREEN">#
#!/usr/bin/perl
# update_z script:
# Determine the options according to the format of the queue name
#  Inspired by the psfilter code of Andreas Klemm
#  and Thomas Bueschgens 
# First, get command line arguments
#
use Getopt::Std;
my(%args,$Q,$Zopts,@file);
getopts(
"A:B:C:D:E:F:G:H:I:J:K:L:M:N:O:P:Q:R:S:T:U:V:W:X:Y:Z:" .
"a:b:cd:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z:",
\%args );
# read stdin
@file = &lt;STDIN&gt;;
$Zopts = "";
# first use command line Queue name
$Q = $args{"Q"};
if( not $Q and (($Q) = grep(/^Q/,@file)) ){
   # next use control file Queue name
    chomp $Q if $Q;
}
# now we split up the name and use as parameters for Z options
while( $Q =~ /_([^_]+)/g ){
    # you can add them or test and then add them
    if( $1 eq "landscape"
        or $1 eq "legal"
        or $1 eq "ledger" ){
        $Zopts .= ",$1"
    }
}
if( $Zopts ){
    # remove leading comma
    $Zopts = substr( $Zopts, 1 );
    #replace or prefix Z options
    if( not (grep { s/$/,$Zopts/ if /^Z/; } @file) ){
        print "Z" . $Zopts . "\n";
    }
}
print @file if( @file );
exit 0

Example Input:
...
Z=over
Q=lp_landscape_ledger
...

Example output:

Z=over,landscape,ledger
Q=lp_landscape_ledger</pre>
      </div>
      <p>The Perl script first uses the <code class=
      "FUNCTION">getopts</code> function to parse the command line
      options. If there is not a command line <tt class=
      "LITERAL">-Q</tt> option then the control file <tt class=
      "LITERAL">Q</tt> line is used after stripping the trailing
      newline. The queue name is then split up into parts separated
      by underscores (<tt class="LITERAL">_</tt>) and those used as
      option names. As shown in the example, the literal values are
      placed in the control file. You can also use the following
      code segment to translate short forms of options into longer
      ones:</p>
      <div class="INFORMALEXAMPLE">
        <a name="AEN3895" id="AEN3895"></a>
        <pre class="SCREEN">while( $Q =~ /_([^_]+)/g ){
    # you can add them or test and then add them
    Zopts .= ",landscape" if( $1 eq "ld" );
    Zopts .= ",ledger" if( $1 eq "11" );
    Zopts .= ",legal" if( $1 eq "15" );
    Zopts .= ",a4" if( $1 eq "a4" );
}</pre>
      </div>
    </div>
  </div>
  <div class="NAVFOOTER">
    <hr align="left" width="100%">
    <table summary="Footer navigation table" width="100%" border=
    "0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="33%" align="left" valign="top"><a href=
        "x3699.htm" accesskey="P">Prev</a></td>
        <td width="34%" align="center" valign="top"><a href=
        "index.htm" accesskey="H">Home</a></td>
        <td width="33%" align="right" valign="top"><a href=
        "x3897.htm" accesskey="N">Next</a></td>
      </tr>
      <tr>
        <td width="33%" align="left" valign="top">Routing Jobs To
        Print Queues</td>
        <td width="34%" align="center" valign="top"><a href=
        "tutorial.htm" accesskey="U">Up</a></td>
        <td width="33%" align="right" valign="top">Interfacing to
        Non-LPRng Spoolers</td>
      </tr>
    </table>
  </div>
  <p align="center"></p>
</body>
</html>