1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
3<html>
4  <head>
5    <meta name="generator" content="HTML Tidy, see www.w3.org">
6    <title>Simple Client Printcap Entry&#13;</title>
7    <meta name="GENERATOR" content=
8    "Modular DocBook HTML Stylesheet Version 1.7">
9    <link rel="HOME" title=" LPRng Reference Manual" href=
10    "index.htm">
11    <link rel="UP" title="Printcap Database " href=
12    "printcapref.htm">
13    <link rel="PREVIOUS" title="Printcap Database " href=
14    "printcapref.htm">
15    <link rel="NEXT" title="Simple Server Printcap Example" href=
16    "cm.htm">
17  </head>
18
19  <body class="SECT1" bgcolor="#FFFFFF" text="#000000" link=
20  "#0000FF" vlink="#840084" alink="#0000FF">
21    <div class="NAVHEADER">
22      <table summary="Header navigation table" width="100%" border=
23      "0" cellpadding="0" cellspacing="0">
24        <tr>
25          <th colspan="3" align="center">LPRng Reference Manual: 5
26          Sep 2003 (For LPRng-3.8.22)</th>
27        </tr>
28
29        <tr>
30          <td width="10%" align="left" valign="bottom"><a href=
31          "printcapref.htm" accesskey="P">Prev</a></td>
32
33          <td width="80%" align="center" valign="bottom">Chapter
34          12. Printcap Database</td>
35
36          <td width="10%" align="right" valign="bottom"><a href=
37          "cm.htm" accesskey="N">Next</a></td>
38        </tr>
39      </table>
40      <hr align="LEFT" width="100%">
41    </div>
42
43    <div class="SECT1">
44      <h1 class="SECT1"><a name="SIMPLE">12.2. Simple Client
45      Printcap Entry</a></h1>
46
47      <p>Options used:</p>
48
49      <ul>
50        <li>
51          <p><var class="LITERAL">client</var> FLAG <span class=
52          "emphasis"><i class="EMPHASIS">client printcap
53          entry</i></span></p>
54        </li>
55
56        <li>
57          <p><var class="LITERAL">lp=</var><span class=
58          "emphasis"><i class="EMPHASIS">destination printer
59          information</i></span></p>
60        </li>
61
62        <li>
63          <p><var class="LITERAL">rm=</var><span class=
64          "emphasis"><i class="EMPHASIS">remote host
65          (machine)</i></span></p>
66        </li>
67
68        <li>
69          <p><var class="LITERAL">rp=</var><span class=
70          "emphasis"><i class="EMPHASIS">remote
71          printer</i></span></p>
72        </li>
73      </ul>
74      <br>
75      <br>
76
77      <p>I'll use this simple example to explain the basics of the
78      <b class="APPLICATION">LPRng</b> printcap format and
79      introduce some of the <b class="APPLICATION">LPRng</b>
80      network configuration options. Here is a simple printcap file
81      used to provide client programs (<var class="LITERAL">lpr,
82      lprm,</var> etc) with <span class="emphasis"><i class=
83      "EMPHASIS">remote printer</i></span> and <span class=
84      "emphasis"><i class="EMPHASIS">server</i></span>
85      information.</p>
86
87      <div class="INFORMALEXAMPLE">
88        <a name="AEN5525"></a>
89<pre class="SCREEN">
90    # printer lp1
91    lp1|printer1
92      :rm=localhost
93    # printer lp2 with continuation
94    lp2:\
95      :lp=pr@10.0.0.1:client
96    # printcap lp3, to printer pr, with overrides
97    lp3:rp=pr:rm=hp.private
98      :force_localhost@
99    # Simplest possible printcap entry - defaults for everything
100    lp4
101</pre>
102      </div>
103
104      <ol type="1">
105        <li>
106          <p>Lines starting with a <var class="LITERAL">#</var>
107          sign are comments, and all leading and trailing <span
108          class="emphasis"><i class=
109          "EMPHASIS">whitespace</i></span>, i.e. - spaces, tabs,
110          etc, are ignored. Empty lines are ignored as well.</p>
111        </li>
112
113        <li>
114          <p>A printcap entry starts with the printcap entry <span
115          class="emphasis"><i class="EMPHASIS">name</i></span>,
116          followed by one or more <span class="emphasis"><i class=
117          "EMPHASIS">aliases</i></span>, followed by one or more
118          options. In the above example we have three printcap
119          entries: <var class="LITERAL">lp1</var> with an alias
120          <var class="LITERAL">printer1</var> and <var class=
121          "LITERAL">lp2</var>, <var class="LITERAL">lp3</var>, and
122          <var class="LITERAL">lp4</var> with no aliases.</p>
123        </li>
124
125        <li>
126          <p>Aliases start with the <var class="LITERAL">|</var>
127          character and options with the <var class=
128          "LITERAL">:</var> character; tabs and spaces before and
129          after the <var class="LITERAL">|</var> or <var class=
130          "LITERAL">:</var> characters and at the start and end of
131          lines are ignored. You can use backslash (<var class=
132          "LITERAL">\</var>) at the end of a line to create a
133          multi-line value for an option. The backslash will cause
134          the next line to be appended to the current line; watch
135          out for comments and ends of printcap entries if you use
136          this facility. As you can see from the example, there is
137          no <var class="LITERAL">Name</var> printcap entry - this
138          is part of the <var class="LITERAL">cm</var> option on
139          the previous line.</p>
140        </li>
141
142        <li>
143          <p>Options take the form of a keyword/value pair,
144          i.e.-</p>
145
146          <p class="LITERALLAYOUT">:option=value<br>
147          :option#value&nbsp;&nbsp;&nbsp;(legacy,&nbsp;not&nbsp;advised&nbsp;for&nbsp;new&nbsp;systems)<br>
148
149          :option<br>
150          :option@</p>
151          <br>
152          <br>
153        </li>
154
155        <li>
156          <p>Option names are case insensitive, but option values
157          are not. While <var class="LITERAL">Ts</var> and <var
158          class="LITERAL">ts</var> are the same option name, <var
159          class="LITERAL">ts=Testing</var> and <var class=
160          "LITERAL">ts=testing</var> have their case preserved. A
161          string or integer value is specified by <var class=
162          "LITERAL">option=value</var> or <var class=
163          "LITERAL">option#value</var>.</p>
164        </li>
165
166        <li>
167          <p>The use of the legacy <var class=
168          "LITERAL">option#value</var> form is <acronym class=
169          "ACRONYM">NOT</acronym> recommended as some preprocessors
170          and database systems will treat <span class="emphasis"><i
171          class="EMPHASIS">#</i></span> as the start of a comment
172          and delete the remainder of the line. This has caused
173          great consternation for sysadmins who wonder why their
174          NIS distributed printcap entries have been mysteriously
175          truncated.</p>
176        </li>
177
178        <li>
179          <p>If you want to set a string option to <span class=
180          "emphasis"><i class="EMPHASIS">empty</i></span> value,
181          use <var class="LITERAL">option=</var>. The <var class=
182          "LITERAL">option</var> will set it to <var class=
183          "LITERAL">1</var>. If an option value contains a colon,
184          then use the C (or Perl or Tck/Tk) string escape <var
185          class="LITERAL">\072</var> to represent the value.</p>
186        </li>
187
188        <li>
189          <p>Boolean options are set TRUE (1) if no value follows
190          the keyword and FALSE (0) by appending a <var class=
191          "LITERAL">@</var>. For example <var class=
192          "LITERAL">sh</var> will set <var class="LITERAL">sh</var>
193          to TRUE and <var class="LITERAL">sh@</var> to FALSE.</p>
194        </li>
195      </ol>
196      <br>
197      <br>
198
199      <p>There may be multiple options on the same line, separated
200      by colons.</p>
201
202      <p>Now let's examine the first printcap entry in detail. It
203      is reproduced here for convenience:</p>
204
205      <div class="INFORMALEXAMPLE">
206        <a name="AEN5581"></a>
207<pre class="SCREEN">
208    # printer lp1
209    lp1|printer1
210      :rm=localhost
211</pre>
212      </div>
213
214      <ol type="1">
215        <li>
216          <p>We start with a comment, followed by the printcap
217          entry name and and alias. Aliases are useful when you
218          want to refer to a single printer or print queue by
219          different names. This can be useful in advanced printcap
220          and print queue setups. By default, the remote printer
221          name is the printcap entry name.</p>
222        </li>
223
224        <li>
225          <p>The <var class="LITERAL">rm</var> (remote machine or
226          host) option specifies the name or IP address of the <b
227          class="APPLICATION">lpd</b> host running <b class=
228          "APPLICATION">lpd</b>. In this example the remote host is
229          <var class="LITERAL">localhost</var> or the machine that
230          the client is running on and we assume that the <b class=
231          "APPLICATION">lpd</b> server is running on the localhost.
232          Thus, we would communicate with printer <var class=
233          "LITERAL">lp1@localhost</var>.</p>
234        </li>
235      </ol>
236      <br>
237      <br>
238
239      <p>Let's look at the next printcap entry:</p>
240
241      <div class="INFORMALEXAMPLE">
242        <a name="AEN5595"></a>
243<pre class="SCREEN">
244    # printer lp2 with continuation
245    lp2:\
246      :lp=pr@10.0.0.1:client
247</pre>
248      </div>
249
250      <ol type="1">
251        <li>
252          <p>The <var class="LITERAL">lp2</var> printcap entry
253          illustrates the use (and abuse) of the <var class=
254          "LITERAL">\</var> continuation. If you think about this,
255          we have really defined a printcap entry of the form:</p>
256
257          <div class="INFORMALEXAMPLE">
258            <a name="AEN5602"></a>
259<pre class="SCREEN">
260    lp2: :lp=pr@10.0.0.1:client
261</pre>
262          </div>
263          &#13;<br>
264          <br>
265
266          <p>Luckily, <b class="APPLICATION">LPRng</b> ignores
267          empty options like <var class="LITERAL">::</var>. While
268          it is strongly recommended that <var class=
269          "LITERAL">\</var> be avoided it may be necessary for
270          compatibility with other system utilities.</p>
271        </li>
272
273        <li>
274          <p>The <var class="LITERAL">lp=pr@10.0.0.1</var> literal
275          is an alternate way to specify a remote queue and server.
276          If the <var class="LITERAL">force_localhost</var> default
277          is being used, then the <b class="APPLICATION">LPRng</b>
278          clients will ignore the <var class=
279          "LITERAL">10.0.0.1</var> address and still connect to
280          <var class="LITERAL">pr@localhost</var>. There is further
281          discussion about this in the next section.</p>
282        </li>
283
284        <li>
285          <p>The <var class="LITERAL">client</var> option
286          explicitly labels client only printcap information. The
287          <b class="APPLICATION">lpd</b> server will ignore any
288          printcap with the <var class="LITERAL">client</var>
289          option. When constructing complex printcaps, this option
290          is used to keep ensure that you have consistent printcap
291          information.</p>
292        </li>
293      </ol>
294      The following printcap entry shows how to override the <var
295      class="LITERAL">force_localhost</var> default, and force the
296      <b class="APPLICATION">LPRng</b> clients to connect directly
297      to a remote server: 
298
299      <div class="INFORMALEXAMPLE">
300        <a name="AEN5622"></a>
301<pre class="SCREEN">
302    lp3:rp=pr:rm=hp.private
303      :force_localhost@
304</pre>
305      </div>
306
307      <ol type="1">
308        <li>
309          <p>The <var class="LITERAL">rp=</var> (remote printer)
310          remote print queue name to used when sending commands to
311          the <b class="APPLICATION">lpd</b> print server.</p>
312        </li>
313
314        <li>
315          <p>The <var class="LITERAL">force_localhost@</var>
316          literal is an example of a <span class="emphasis"><i
317          class="EMPHASIS">flag</i></span> option. The <var class=
318          "LITERAL">@</var> sets the literal value to 0 (false). We
319          set <var class="LITERAL">force_localhost</var> to false,
320          which now allows the <b class="APPLICATION">LPRng</b>
321          clients to connect directly to the specified remote
322          printer. In this example, the <tt class=
323          "FILENAME">hp.private</tt> could be a HP LaserJet Printer
324          with a JetDirect interface, which supports the RFC1179
325          protocol.</p>
326        </li>
327
328        <li>
329          <p>One disadvantages of sending a job directly to a
330          printer using the above method is that <b class=
331          "APPLICATION">lpr</b> program will not terminate or exit
332          until all of the files have been transferred to the
333          printer, and this may take a long time as the printer
334          processes the files as they are received.</p>
335        </li>
336      </ol>
337      <br>
338      <br>
339
340      <p>Now let's look at the last printcap entry:</p>
341
342      <div class="INFORMALEXAMPLE">
343        <a name="AEN5641"></a>
344<pre class="SCREEN">
345    # Simplest possible printcap entry - defaults for everything
346    lp4
347</pre>
348      </div>
349      <br>
350      <br>
351
352      <p>The last example is the simplest possible printcap entry.
353      This will cause <b class="APPLICATION">LPRng</b> clients to
354      use the default values for everything. The printer will be
355      <var class="LITERAL">lp4</var>, i.e. - the name of the
356      printcap, and the server will be <var class=
357      "LITERAL">localhost</var> if <var class=
358      "LITERAL">force_localhost</var> is set, or the value of the
359      <var class="LITERAL">default_remote_host</var> configuration
360      option if it is not.</p>
361    </div>
362
363    <div class="NAVFOOTER">
364      <hr align="LEFT" width="100%">
365
366      <table summary="Footer navigation table" width="100%" border=
367      "0" cellpadding="0" cellspacing="0">
368        <tr>
369          <td width="33%" align="left" valign="top"><a href=
370          "printcapref.htm" accesskey="P">Prev</a></td>
371
372          <td width="34%" align="center" valign="top"><a href=
373          "index.htm" accesskey="H">Home</a></td>
374
375          <td width="33%" align="right" valign="top"><a href=
376          "cm.htm" accesskey="N">Next</a></td>
377        </tr>
378
379        <tr>
380          <td width="33%" align="left" valign="top">Printcap
381          Database</td>
382
383          <td width="34%" align="center" valign="top"><a href=
384          "printcapref.htm" accesskey="U">Up</a></td>
385
386          <td width="33%" align="right" valign="top">Simple Server
387          Printcap Example</td>
388        </tr>
389      </table>
390    </div>
391  </body>
392</html>
393
394