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 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<title>Printcap Database</title>
<meta name="GENERATOR" content=
"Modular DocBook HTML Stylesheet Version 1.71 ">
<link rel="HOME" title=" LPRng-HOWTO" href="index.htm">
<link rel="PREVIOUS" title="Serial Printers " href=
"secserial.htm">
<link rel="NEXT" title="Simple Client Printcap Entry " href=
"simple.htm">
</head>
<body class="CHAPTER" 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-HOWTO: 1 Apr 2002
(For LPRng-3.8.10)</th>
</tr>
<tr>
<td width="10%" align="left" valign="bottom"><a href=
"secserial.htm" accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">
</td>
<td width="10%" align="right" valign="bottom"><a href=
"simple.htm" accesskey="N">Next</a></td>
</tr>
</table>
<hr align="LEFT" width="100%">
</div>
<div class="CHAPTER">
<h1><a name="PRINTCAPREF">Chapter 12. Printcap
Database</a></h1>
<div class="TOC">
<dl>
<dt><b>Table of Contents</b></dt>
<dt>12.1. <a href="printcapref.htm#PRINTCAPPARSE">The
Printcap Parsing Rules</a></dt>
<dt>12.2. <a href="simple.htm">Simple Client Printcap
Entry</a></dt>
<dt>12.3. <a href="cm.htm">Simple Server Printcap
Example</a></dt>
<dt>12.4. <a href="x5679.htm">Using :oh To Select
Printcap Information</a></dt>
<dt>12.5. <a href="x5705.htm">Using the Wildcard Printcap
Entry</a></dt>
<dt>12.6. <a href="x5717.htm">Enterprise Strength
Printcap Example</a></dt>
<dt>12.7. <a href="x5734.htm">Remote Printer Using
RFC1179</a></dt>
<dt>12.8. <a href="x5768.htm">Remote Printer Using Socket
API</a></dt>
<dt>12.9. <a href="x5795.htm">Parallel Printer</a></dt>
<dt>12.10. <a href="serial.htm">Serial Printer</a></dt>
<dt>12.11. <a href="lpdbounce.htm">Bounce Queue</a></dt>
<dt>12.12. <a href="translateformat.htm">Job Format
Translation</a></dt>
<dt>12.13. <a href="destinations.htm">Dynamic
Routing</a></dt>
<dt>12.14. <a href="loadbalance.htm">Printer Load
Balancing</a></dt>
<dt>12.15. <a href="printcappath.htm">Locations of
Printcap Files</a></dt>
<dt>12.16. <a href="secoh.htm">Single Printcap File for
Large Installation</a></dt>
<dt>12.17. <a href="x6065.htm">Management Strategies for
Large Installations</a></dt>
<dt>12.18. <a href="secnis.htm">Using Programs To Get
Printcap Information</a></dt>
<dt>12.19. <a href="x6175.htm">Lexmark Printers</a></dt>
<dt>12.20. <a href="p450.htm">Tektronix Phaser
Printers</a></dt>
<dt>12.21. <a href="x6189.htm">Duplex Printing</a></dt>
<dt>12.22. <a href="x6210.htm">Solaris, Newsprint and
FrameMaker</a></dt>
</dl>
</div>
<p>As described in the <a href="tutorial.htm#OVERVIEW">Print
Spooling Overview</a>, the heart of the <b class=
"APPLICATION">LPRng</b> system is information in the <tt
class="FILENAME">printcap</tt> file. The printcap information
specifies:</p>
<ol type="1">
<li>
<p>The print queues available to users.</p>
</li>
<li>
<p>How client programs communicate with the <b class=
"APPLICATION">lpc</b> print server.</p>
</li>
<li>
<p>The configuration, location, and other information for
each print queue on the print server.</p>
</li>
<li>
<p>How the <b class="APPLICATION">lpd</b> server
processes jobs in each print queue.</p>
</li>
</ol>
<br>
<br>
<p>In order to explain a complex subject, we will start with
a set of simple printer configurations, and explain the
purpose and effect of each entry in the printcap.</p>
<p>For details about individual printcap options, see the
<span class="CITEREFENTRY"><span class=
"REFENTRYTITLE">printcap</span>(5)</span> man page from the
<b class="APPLICATION">LPRng</b> distribution, or use the <a
href="optionindex.htm">Index To All The Configuration and
Printcap Options</a> to find a specific printcap option and
its effects.</p>
<div class="SECT1">
<h1 class="SECT1"><a name="PRINTCAPPARSE">12.1. The
Printcap Parsing Rules</a></h1>
<p>Options used:</p>
<ul>
<li>
<p><tt class="LITERAL">client</tt> FLAG <i class=
"EMPHASIS">printcap entry valid only for client
programs</i></p>
</li>
<li>
<p><tt class="LITERAL">oh=</tt> <i class=
"EMPHASIS">hosts where printcap entry valid</i></p>
</li>
<li>
<p><tt class="LITERAL">server</tt> <i class=
"EMPHASIS">printcap entry valid only for lpd
server</i></p>
</li>
<li>
<p><tt class="LITERAL">tc</tt> <i class="EMPHASIS">add
named printcap entry contents</i></p>
</li>
</ul>
<br>
<br>
<p>In this section, we will discuss the remaining tricky
parts of the <b class="APPLICATION">LPRng</b> printcap
database: combined client and server printcaps, host
specific printcap entries, and the <tt class=
"LITERAL">tc</tt> <i class="EMPHASIS">include</i>
facility.</p>
<p>The following is a complete description of how a
printcap file is processed:</p>
<ol type="1">
<li>
<p>When processing a printcap file, the <b class=
"APPLICATION">LPRng</b> software reads and parses each
entry individually. Leading whitespace is removed.
Lines starting with <tt class="LITERAL">#</tt> and
blank lines are ignored.</p>
</li>
<li>
<p>Lines ending with <tt class="LITERAL">\</tt> will
have the <tt class="LITERAL">\</tt> discarded, and all
lines of a printcap entry are joined by removing the
line separators (<tt class="LITERAL">\n</tt>) and
replacing them with a space.</p>
</li>
<li>
<p>The printcap entry is parsed, and the printcap name,
aliases, and options are determined. Colons <tt class=
"LITERAL">:</tt> act as option separators, and leading
and trailing whitespaces are removed.</p>
</li>
<li>
<p>Options are sorted and except for the <tt class=
"LITERAL">tc=...</tt> option only the last option
setting is retained.</p>
</li>
<li>
<p>If an option value requires a colon, then the <tt
class="LITERAL">\:</tt> or <tt class=
"LITERAL">\072</tt>, the same escaped character value
as used in the C, Perl, tcl, and other programming
languages, can be used.</p>
</li>
<li>
<p>Client programs will discard a printcap entry with a
<tt class="LITERAL">server</tt> option and server
programs will discard a printcap entry with a <tt
class="LITERAL">client</tt> options.</p>
</li>
<li>
<p>The <tt class="LITERAL">oh</tt> (<i class=
"EMPHASIS">o</i>n this <i class="EMPHASIS">h</i>ost)
option specifies a list of IP addresses and mask pairs
or glob strings which are used to determine if this
printcap entry is valid for this host (see discussion
below).</p>
</li>
<li>
<p>After the above processing, if there is an existing
termcap entry with the same name, the two sets of
options are combined, with the last option setting
retained except for the <tt class="LITERAL">tc</tt>
entries which are combined.</p>
</li>
<li>
<p>When a printcap entry is actually used, the printcap
entries listed by the <tt class="LITERAL">tc</tt>
include option are extracted and combined in order.
This allows include entries to appear after the
referring printcap entry. Then printcap options will be
combined with the included ones. This has the effect
that the options specified in the printcap entry will
override the ones from the <tt class="LITERAL">tc</tt>
included entries.</p>
</li>
<li>
<p>Finally, each string printcap option with a <i
class="EMPHASIS">%X</i> value has <i class=
"EMPHASIS">%X</i> replaced by the following values.
Unspecified values will not be modified.</p>
<div class="INFORMALTABLE">
<a name="AEN5361"></a>
<table border="1" class="CALSTABLE">
<thead>
<tr>
<th align="LEFT" valign="TOP">Key</th>
<th align="LEFT" valign="TOP">Value</th>
<th align="LEFT" valign="TOP">Purpose</th>
</tr>
</thead>
<tbody>
<tr>
<td align="LEFT" valign="TOP"><tt class=
"LITERAL">%P</tt></td>
<td align="LEFT" valign="TOP">printcap entry
primary name</td>
<td> </td>
</tr>
<tr>
<td align="LEFT" valign="TOP"><tt class=
"LITERAL">%Q</tt></td>
<td align="LEFT" valign="TOP">queue
requested</td>
<td> </td>
</tr>
<tr>
<td align="LEFT" valign="TOP"><tt class=
"LITERAL">%h</tt></td>
<td align="LEFT" valign="TOP">short host name
(host)</td>
<td> </td>
</tr>
<tr>
<td align="LEFT" valign="TOP"><tt class=
"LITERAL">%H</tt></td>
<td align="LEFT" valign="TOP">fully qualified
host name (host.dns.whatever)</td>
<td> </td>
</tr>
<tr>
<td align="LEFT" valign="TOP"><tt class=
"LITERAL">%R</tt></td>
<td align="LEFT" valign="TOP">remote printer
(rp value)</td>
<td> </td>
</tr>
<tr>
<td align="LEFT" valign="TOP"><tt class=
"LITERAL">%M</tt></td>
<td align="LEFT" valign="TOP">remote host (rm
value)</td>
<td> </td>
</tr>
<tr>
<td align="LEFT" valign="TOP"><tt class=
"LITERAL">%D</tt></td>
<td align="LEFT" valign="TOP">date in
YYYY-MM-DD format</td>
<td> </td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
</li>
<li>
<p>When parsing multiple printcap files, these are
processed in order, and all of their printcap entries
are combined according to the above procedures. The <tt
class="LITERAL">tc</tt> resolution and <i class=
"EMPHASIS">%X</i> expansion is done after all the files
have been processed.</p>
</li>
</ol>
<br>
<br>
<p>The following examples show how to use the above rules
to your advantage. You can combine both client and server
printcap information in a single file as well as dividing a
printcap entry into several parts. Here is an example:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN5402"></a>
<pre class="SCREEN">
# seen by both client and server
lp1:lp=lp@pr1:mx=100
lp1:sd=/usr/local/spool/lp1:mx=0
# seen only by client
lp2:lp=lp@pr2:client
# seen only by server
lp2:lp=/dev/lp:server
</pre>
</div>
<ol type="1">
<li>
<p>Printcap entries with the same name are combined.
The first printcap entry, <tt class="LITERAL">lp1</tt>,
the information is seen by both client and server. The
next printcap entry, with the same name <tt class=
"LITERAL">lp1</tt>, will be combined with the first
one. The order of options is important - the entries
are scanned in order and an option will have the last
value set. Thus, after having read both the <tt class=
"LITERAL">lp1</tt> printcap entries, both client and
server will have:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN5410"></a>
<pre class="SCREEN">
lp1:lp=lp@pr1
:mx=0
:sd=/usr/local/spool/lp1
</pre>
</div>
<br>
<br>
</li>
<li>
<p>The <tt class="LITERAL">lp2</tt> has a client and
server version. This is recommended when complex
printcaps on multiple hosts and servers are used. Thus,
the <b class="APPLICATION">LPRng</b> clients will
see:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN5416"></a>
<pre class="SCREEN">
lp1
:lp=lp@pr1
:mx=0
:sd=/usr/local/spool/lp1
lp2
:client
:lp=lp@pr2
</pre>
</div>
and the server will see:
<div class="INFORMALEXAMPLE">
<a name="AEN5418"></a>
<pre class="SCREEN">
lp1
:lp=lp@pr1
:mx=0
:sd=/usr/local/spool/lp1
lp2
:lp=/dev/lp
:server
</pre>
</div>
<br>
<br>
</li>
</ol>
<br>
<br>
<p>If you have multiple printers of the same type whose
configuration is almost identical, then you can define a
set of <i class="EMPHASIS">tc</i> only printcap entries
containing common information and use the <tt class=
"LITERAL">tc</tt> include facility.</p>
<p>Printcap entry names may start with period (<tt class=
"LITERAL">.</tt>), question mark (<tt class=
"LITERAL">?</tt>), or exclamation mark (<tt class=
"LITERAL">!</tt>), followed by one or more alphanumeric ,
underscore (<tt class="LITERAL">_</tt>) or hyphen (<tt
class="LITERAL">-</tt>) characters. Queue or printer names
start with an alphanumeric character. Printcap entries
whose names do not start with an alphanumeric character can
only be used as targets of the <tt class="LITERAL">tc</tt>
include facility. For example:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN5430"></a>
<pre class="SCREEN">
.hp:
:sd=/usr/local/spool/%P
:mx=0
hp1:tc=.hp,.filter
:lp=lp@10.0.0.1
hp2:tc=.hp,.filter
:lp=lp@10.0.0.2
.filter
:filter=/usr/local/libexec/filters/ifhp
</pre>
</div>
<ol type="1">
<li>
<p>The <tt class="FILENAME">.hp</tt> and <tt class=
"FILENAME">.filter</tt> printcap entities are not spool
queue definitions. After <tt class="LITERAL">tc</tt>
include processing is completed, the printcap
information would resemble:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN5438"></a>
<pre class="SCREEN">
hp1
:lp=lp@10.0.0.1
:filter=/usr/local/libexec/filters/ifhp
:mx=0
:sd=/usr/local/spool/%P
hp2
:lp=lp@10.0.0.2
:filter=/usr/local/libexec/filters/ifhp
:mx=0
:sd=/usr/local/spool/%P
</pre>
</div>
<br>
<br>
</li>
<li>
<p>The <tt class="LITERAL">%X</tt> processing will
replace <tt class="LITERAL">%P</tt> with the printcap
name, so we would have:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN5444"></a>
<pre class="SCREEN">
hp1
:lp=lp@10.0.0.1
:filter=/usr/local/libexec/filters/ifhp
:mx=0
:sd=/usr/local/spool/hp1
hp2
:lp=lp@10.0.0.2
:filter=/usr/local/libexec/filters/ifhp
:mx=0
:sd=/usr/local/spool/hp2
</pre>
</div>
<br>
<br>
</li>
</ol>
<br>
<br>
</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=
"secserial.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=
"simple.htm" accesskey="N">Next</a></td>
</tr>
<tr>
<td width="33%" align="left" valign="top">Serial
Printers</td>
<td width="34%" align="center" valign="top"> </td>
<td width="33%" align="right" valign="top">Simple Client
Printcap Entry</td>
</tr>
</table>
</div>
</body>
</html>
|