<?Pub UDT _bookmark _target?><?Pub UDT __target_1 _target?><?Pub UDT registeredtm trademark?><chapter id="printcust-66310"><?Pub Tag atict:info tracking="off" ref="1"?><?Pub Tag
atict:user user="jonj" fullname="Juanita Heieck"?><?Pub Tag atict:user
user="jh118764" fullname="Juanita Heieck"?><?Pub Tag atict:user user="wsm"
fullname=""?><title>Customizing Printing Services and Printers (Tasks)</title><highlights><para>This chapter provides overview information and procedures for customizing
printing services and printers.</para>
</highlights><sect1 id="emjin"><title>Customizing Printing Services (Task Map)</title><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="33*"/><colspec colwidth="33*"/><colspec colname="colspec1" colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Add a <literal>terminfo</literal> entry of an unsupported printer.</para>
</entry><entry><para>Add an entry to the <literal>terminfo</literal> database to initialize
an unsupported printer and establish required settings.</para>
</entry><entry><para><olink targetptr="printcust-24894" remap="internal">How to Add a terminfo Entry for an
Unsupported Printer</olink></para>
</entry>
</row><row><entry><para>Set up a custom printer interface program.</para>
</entry><entry><para>You can furnish a custom printer interface program if you have a printer
that is not supported by the standard printer interface program.</para>
</entry><entry><para><olink targetptr="printcust-47894" remap="internal">How to Set Up a Custom Printer Interface
Program</olink></para>
</entry>
</row><row><entry><para>Adjust the printer port characteristics.</para>
</entry><entry><para>Make printer port characteristics the are set by the LP print service
compatible with the printer communication settings. </para>
</entry><entry><para><olink targetptr="printcust-46383" remap="internal">How to Adjust the Printer Port Characteristics</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><sect2 id="printcust-72543"><title>Adjusting Printer Port Characteristics</title><indexterm id="printcust-ix707"><primary>printer port</primary><secondary>characteristics, adjusting (overview)</secondary>
</indexterm><indexterm id="printcust-ix708"><primary>adjusting printer port characteristics (overview)</primary>
</indexterm><para>The printer port characteristics set by the LP print service must be
compatible with the printer communication settings. If the default printer
port settings provided by the LP print service do not work with a printer,
refer to the printer manual from the manufacturer to determine what settings
the printer requires from the LP print service. Use the <command>stty</command> command
to set and display printer communication settings.</para><para><indexterm id="printcust-ix709"><primary>stty settings</primary><secondary> defaults</secondary></indexterm><indexterm id="printcust-ix710"><primary>printer(s)</primary><secondary>settings</secondary><tertiary>stty</tertiary></indexterm>The following table shows the default <command>stty</command> settings
that are used by the LP print service.</para><table frame="topbot" id="printcust-23215"><title>Default <command>stty</command> Settings
Used by the LP Print Service</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="column1" colwidth="108*"/><colspec colname="column2" colwidth="252*"/><thead><row rowsep="1"><entry><para>Option</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><option>9600</option></para>
</entry><entry><para>Sets baud to 9600</para>
</entry>
</row><row><entry><para><option>cs8</option></para>
</entry><entry><para>Sets 8-bit bytes</para>
</entry>
</row><row><entry><para><option>cstopb</option></para>
</entry><entry><para>Sends one stop bit per byte</para>
</entry>
</row><row><entry><para><option>parity</option></para>
</entry><entry><para>Does not generate parity</para>
</entry>
</row><row><entry><para><option>ixon</option></para>
</entry><entry><para>Enables XON/XOFF (also known as START/STOP or DC1/DC3)</para>
</entry>
</row><row><entry><para><option>opost</option></para>
</entry><entry><para>Does  &ldquo;output post-processing&rdquo; using all the settings that
follow in this table</para>
</entry>
</row><row><entry><para><option>olcuc</option></para>
</entry><entry><para>Do not map lowercase to uppercase</para>
</entry>
</row><row><entry><para><option>onlcr</option></para>
</entry><entry><para>Changes linefeed to carriage return/linefeed</para>
</entry>
</row><row><entry><para><option>ocrnl</option></para>
</entry><entry><para>Does not change carriage returns into linefeeds</para>
</entry>
</row><row><entry><para><option>onocr</option></para>
</entry><entry><para>Outputs carriage returns even at column 0</para>
</entry>
</row><row><entry><para><option>n10</option></para>
</entry><entry><para>Provides no delay after linefeeds</para>
</entry>
</row><row><entry><para><option>cr0</option></para>
</entry><entry><para>Provides no delay after carriage returns</para>
</entry>
</row><row><entry><para><option>tab0</option></para>
</entry><entry><para>Provides no delay after tabs</para>
</entry>
</row><row><entry><para><option>bs0</option></para>
</entry><entry><para>Provides no delay after backspace characters</para>
</entry>
</row><row><entry><para><option>vt0</option></para>
</entry><entry><para>Provides no delay after vertical tabs</para>
</entry>
</row><row><entry><para><option>ff0</option></para>
</entry><entry><para>Provides no delay after form feeds</para>
</entry>
</row>
</tbody>
</tgroup>
</table><task id="printcust-46383"><title>How to Adjust the Printer Port Characteristics</title><indexterm><primary>printer port</primary>
</indexterm><procedure><step id="printcust-step-2"><para>Log in as superuser, <literal>lp</literal>,
or assume an equivalent role on the print server.</para>
</step><step id="printcust-step-3"><para><indexterm id="printcust-ix712"><primary><command>lpadmin</command> command</primary><secondary>adjusting printer port characteristics with (how to)</secondary></indexterm>Adjust the printer port characteristics.</para><screen># <userinput>lpadmin -p</userinput> <replaceable>printer-name</replaceable> <userinput>-o "stty=</userinput><replaceable>options</replaceable><userinput>"</userinput></screen><variablelist><varlistentry><term><option>p</option></term><listitem><para>Specifies the name of the printer for which you are adjusting
the port characteristics.</para>
</listitem>
</varlistentry><varlistentry><term><option>o</option> &ldquo;stty=<replaceable>options&rdquo;</replaceable></term><listitem><para>Sets the port characteristic (<command>stty</command> option)
specified by <replaceable>options</replaceable>. You can change more than
one <command>stty</command> option setting with this command. Enclose each
option in single quotation marks, and use a space to separate the options.
 For a complete list of options, see the<olink targetdoc="refman" targetptr="stty-1" remap="external"><citerefentry><refentrytitle>stty</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page. <olink targetptr="printcust-23215" remap="internal">Table&nbsp;7&ndash;1</olink> shows the default <command>stty</command> settings used by the LP
print service. </para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="printcust-step-47"><para>Verify that the printer port characteristics
have been changed.</para><screen># <userinput>lpstat -p</userinput> <replaceable>printer-name</replaceable> <userinput>-l</userinput></screen>
</step>
</procedure><example id="emjgx"><title>Adjusting the Printer Port Characteristics</title><para>This example shows how to set the port characteristics for the printer <literal>luna</literal>. The <literal>parenb</literal> option enables parity checking/generation.
The <literal>parodd</literal> option sets odd parity generation. The <literal>cs7</literal> option sets the character size to 7 bits.</para><screen># <userinput>lpadmin -p luna -o "stty='parenb parodd cs7'"</userinput></screen>
</example><example id="emjij"><title>Setting the Terminal Baud Rate</title><para>This example shows how to set the terminal baud rate to 19200 for the
printer <literal>venus</literal>. </para><screen># <userinput>lpadmin -p venus -o "stty=19200"</userinput></screen>
</example>
</task>
</sect2><sect2 id="printcust-11157"><title>Adding a <literal>terminfo</literal> Entry
for an Unsupported Printer</title><indexterm id="printcust-ix714"><primary>printer(s)</primary><secondary>adding an unsupported (overview)</secondary>
</indexterm><indexterm id="printcust-ix715"><primary>adding</primary><secondary><literal>terminfo</literal> entry (overview)</secondary>
</indexterm><indexterm id="printcust-ix716"><primary><literal>terminfo</literal> entry</primary><secondary>adding (overview)</secondary>
</indexterm><indexterm id="printcust-ix717"><primary>unsupported printers</primary>
</indexterm><itemizedlist><para>The LP print service uses an interface program and the <filename>terminfo</filename> database
to initialize each printer and establish the following:</para><listitem><para>Selected page size</para>
</listitem><listitem><para>Character pitch</para>
</listitem><listitem><para>Line pitch</para>
</listitem><listitem><para>Character set</para>
</listitem>
</itemizedlist><para>Each printer is identified in the <filename>terminfo</filename> database
with a short name. The short name required by the <filename>terminfo</filename> database
is identical to the name used to set the <command>TERM</command> shell variable.
This name is also the printer type that you specify when setting up a printer.
For example, the entries for different types of PostScript printers are in
the <filename>/usr/share/lib/terminfo/P</filename> directory. The default
entries provided with the SunOS software release are <literal>PS</literal> (for
PostScript) and <literal>PSR</literal> (for PostScript Reverse). </para><para>If you cannot find a <literal>terminfo</literal> entry for your printer,
you still might be able to use the printer with the LP print service without
the automatic selection of page size, pitch, and character sets. However,
you might have trouble keeping the printer set in the correct modes for each
print request.</para><itemizedlist><para><indexterm id="printcust-ix718"><primary><filename>terminfo</filename> entry</primary><secondary>list of required items</secondary></indexterm>If no <literal>terminfo</literal> entry exists for your type of printer and you want to keep
the printer set in the correct modes, you can do one of the following:</para><listitem><para>Customize the interface program used with the printer.</para>
</listitem><listitem><para>Add an entry to the <literal>terminfo</literal> database.</para>
</listitem>
</itemizedlist><para>A terminal or printer entry in the <literal>terminfo</literal> database
contains and defines hundreds of items. The LP print service, however, uses
fewer than 50 of these items. The following table lists the required <filename>terminfo</filename> items for a printer.</para><table frame="topbot" pgwide="1" id="printcust-89662"><title>Required <literal>terminfo</literal> Items for a Printer (Booleans)</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="column1" colwidth="43*"/><colspec colname="column2" colwidth="64*"/><colspec colname="column3" colwidth="249*"/><thead><row rowsep="1"><entry><para>Item</para>
</entry><entry><para></para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para>Booleans:</para>
</entry><entry><para></para>
</entry><entry><para></para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>cpix</literal></para>
</entry><entry><para>Changing character pitch changes resolution</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>daisy</literal></para>
</entry><entry><para>Printer requires an operator to change character set</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>lpix</literal></para>
</entry><entry><para>Changing line pitch changes resolution</para>
</entry>
</row>
</tbody>
</tgroup>
</table><table frame="topbot" pgwide="1" id="frylo"><title>Required <literal>terminfo</literal> Items
for a Printer (Numbers)</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="column1" colwidth="43*"/><colspec colname="column2" colwidth="64*"/><colspec colname="column3" colwidth="249*"/><thead><row rowsep="1"><entry><para>Item</para>
</entry><entry><para></para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para>Numbers:</para>
</entry><entry><para></para>
</entry><entry><para></para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>bufsx</literal></para>
</entry><entry><para>Number of bytes buffered before printing</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>cols</literal></para>
</entry><entry><para>Number of columns in a line</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>cps</literal></para>
</entry><entry><para>Average print rate in characters per second</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>it</literal></para>
</entry><entry><para>Tabs initially every <replaceable>n</replaceable> spaces</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>lines</literal></para>
</entry><entry><para>Number of lines on a page</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>orc</literal></para>
</entry><entry><para>Horizontal resolution, in units per character</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>orhi</literal></para>
</entry><entry><para>Horizontal resolution, in units per inch</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>orl</literal></para>
</entry><entry><para>Vertical resolution, in units per line</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>orvi</literal></para>
</entry><entry><para>Vertical resolution, in units per inch</para>
</entry>
</row>
</tbody>
</tgroup>
</table><table frame="topbot" pgwide="1" id="fryly"><title>Required <literal>terminfo</literal> Items
for a Printer (Strings)</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="column1" colwidth="43*"/><colspec colname="column2" colwidth="64*"/><colspec colname="column3" colwidth="249*"/><thead><row rowsep="1"><entry><para>Item</para>
</entry><entry><para></para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para>Strings:</para>
</entry><entry><para></para>
</entry><entry><para></para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>chr</literal></para>
</entry><entry><para>Changes horizontal resolution</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>cpi</literal></para>
</entry><entry><para>Changes number of characters per inch</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>cr</literal></para>
</entry><entry><para>Carriage return</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>csnm</literal></para>
</entry><entry><para>List of character set names</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>cudl</literal></para>
</entry><entry><para>Moves carriage down one line</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>cud</literal></para>
</entry><entry><para>Moves carriage down <replaceable>n</replaceable> lines</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>cuf</literal></para>
</entry><entry><para>Moves carriage to the right <replaceable>n</replaceable> columns</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>cvr</literal></para>
</entry><entry><para>Changes vertical resolution</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>ff</literal></para>
</entry><entry><para>Ejects page</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>hpa</literal></para>
</entry><entry><para>Horizontal position absolute</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>ht</literal></para>
</entry><entry><para>Tabs to next 8-space tab stop</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>if</literal></para>
</entry><entry><para>Is the name of initialization file</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>iprog</literal></para>
</entry><entry><para>Is the path name of initialization program</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>is1</literal></para>
</entry><entry><para>Is a printer initialization string</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>is2</literal></para>
</entry><entry><para>Is a printer initialization string</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>is3</literal></para>
</entry><entry><para>Is a printer initialization string</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>lpi</literal></para>
</entry><entry><para>Changes number of lines per inch</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>mgc</literal></para>
</entry><entry><para>Clears all margins (top, bottom, and sides)</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>rep</literal></para>
</entry><entry><para>Repeats a character <replaceable>n</replaceable> times</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>rwidm</literal></para>
</entry><entry><para>Disables double-wide printing</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>scs</literal></para>
</entry><entry><para>Selects character set</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>scsd</literal></para>
</entry><entry><para>Starts definition of a character set</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>slines</literal></para>
</entry><entry><para>Set page length to <replaceable>n</replaceable> lines per page</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>smgl</literal></para>
</entry><entry><para>Sets left margin at current column</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>smglp</literal></para>
</entry><entry><para>Set left margin</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>smgr</literal></para>
</entry><entry><para>Sets right margin at current column</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>smgrp</literal></para>
</entry><entry><para>Sets right margin</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>smglr</literal></para>
</entry><entry><para>Sets both left and right margins</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>msgt</literal></para>
</entry><entry><para>Sets top margin at current line</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>smgtp</literal></para>
</entry><entry><para>Sets top margin</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>smgb</literal></para>
</entry><entry><para>Sets bottom margin at current line</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>smgbp</literal></para>
</entry><entry><para>Sets bottom margin</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>smgtb</literal></para>
</entry><entry><para>Sets both top and bottom margins</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>swidm</literal></para>
</entry><entry><para>Enables double-wide printing</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>vpa</literal></para>
</entry><entry><para>Sets vertical position to absolute</para>
</entry>
</row>
</tbody>
</tgroup>
</table><task id="printcust-24894"><title>How to Add a <filename>terminfo</filename> Entry
for an Unsupported Printer</title><indexterm><primary><filename>terminfo</filename> entry</primary>
</indexterm><tasksummary><note><para>Before you create a <filename>terminfo</filename> entry for a
printer, make sure that none of the existing <filename>terminfo</filename> entries
will support the printer. To do so, try to set up the printer with an entry
for a similar printer, if a similar printer exists.</para>
</note>
</tasksummary><procedure><step id="printcust-step-7"><para>Log in as superuser, <literal>lp</literal>,
 or assume an equivalent role on the print server.</para>
</step><step id="printcust-step-9"><para>Determine a <filename>terminfo</filename> entry
name for the printer.</para><para>The directories in the <filename>/usr/share/lib/terminfo</filename> directory contain all the valid <filename>terminfo</filename> entries.
Use these entries as a guide for choosing a name for the printer.</para>
</step><step id="printcust-step-10"><para>Create a <filename>terminfo</filename> entry
file for the printer.</para><para><olink targetptr="printcust-89662" remap="internal">Table&nbsp;7&ndash;2</olink> shows the items you must define in the <command>terminfo</command> entry
to add a new printer to the LP print service. For more details about the structure
of the <command>terminfo</command> database, see the <olink targetdoc="refman" targetptr="terminfo-4" remap="external"><citerefentry><refentrytitle>terminfo</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man page.</para><para>To help
you start writing a new <filename>terminfo</filename> entry, use the <command>infocmp</command> command to save an existing <filename>terminfo</filename> entry
to a file. This command is helpful if there is a <filename>terminfo</filename> entry
that is similar to entry you want to create. For example, the following command
saves the <literal>ps</literal> entry to the <filename>ps_cust</filename> file,
which will become the new <filename>terminfo</filename> entry.</para><para><filename>infocmp ps &gt; ps_cust</filename></para>
</step><step id="printcust-step-11"><para>Compile the <filename>terminfo</filename> entry
file into the <filename>terminfo</filename> database.</para><screen># <userinput>tic</userinput> <replaceable>terminfo_entry</replaceable></screen><para>where <replaceable>terminfo-entry</replaceable> variable is the <filename>terminfo</filename> entry file you created.</para>
</step><step id="printcust-step-48"><para>Check for the new <filename>terminfo</filename> entry
file in the <filename>/usr/share/lib/terminfo</filename> directory.</para>
</step>
</procedure>
</task>
</sect2><sect2 id="printcust-49492"><title>Customizing the Printer Interface Program</title><indexterm id="printcust-ix720"><primary>printer(s)</primary><secondary>customizing interface program (overview)</secondary>
</indexterm><indexterm id="printcust-ix721"><primary>interface program (printer)</primary><secondary>customizing (overview)</secondary>
</indexterm><indexterm id="printcust-ix722"><primary>customizing</primary><secondary>printer interface program (overview)</secondary>
</indexterm><para>If you have a printer that is not supported by the standard printer
interface program, you can furnish your own printer interface program. You
can copy the standard program and then tell the LP print service to use it
for a specified printer. First, you need to understand what is in the standard
program. The following section describes the standard program.</para><itemizedlist><para>A printer interface program should perform the following tasks:</para><listitem><para>Initialize the printer port, if necessary. The standard printer
interface program uses the <command>stty</command> command to initialize the
printer port.</para>
</listitem><listitem><para>Initialize the printer hardware. The standard printer interface
program receives the control sequences from the <filename>terminfo</filename> database
and the <command>TERM</command> shell variable.</para>
</listitem><listitem><para>Print a banner page, if necessary.</para>
</listitem><listitem><para>Print the number of copies that are specified by the print
request.</para>
</listitem>
</itemizedlist><caution><para>If you have a printer interface program from a release of UNIX
System V prior to release 3.2, it will probably work with the Solaris Express,
SunOS 5.10, or compatible LP print service. However, several <option>o</option> options
have been standardized in the Solaris Express, SunOS 5.10, or compatible LP
print service. These options will be passed to every printer interface program.
These options might interfere with similarly named options used by the old
interface.</para>
</caution><para>The LP print service, not a printer interface program, is responsible
for opening the printer port. The printer port is given to the printer interface
program as standard output. In addition, the printer is identified as the &ldquo;controlling
terminal&rdquo; for the printer interface program so that a &ldquo;hang-up&rdquo;
of the port causes a SIGHUP signal to be sent to the printer interface program.</para><sect3 id="printcust-52759"><title>The Standard Printer Interface Program</title><indexterm id="printcust-ix723"><primary>printer(s)</primary><secondary>interface program</secondary><tertiary>standard</tertiary>
</indexterm><para>The standard (model) printer interface program is <filename>/usr/lib/lp/model/standard</filename>. This program is used by the LP print service to set the printing
defaults shown in the following table.</para><table frame="topbot" id="printcust-16763"><title>Default Printer Port Characteristics</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="column1" colwidth="107*"/><colspec colname="column2" colwidth="252*"/><thead><row rowsep="1"><entry><para>Characteristic</para>
</entry><entry><para>Default Setting</para>
</entry>
</row>
</thead><tbody><row><entry><para>Default filter</para>
</entry><entry><para><literal>None</literal></para>
</entry>
</row><row><entry><para>Character pitch</para>
</entry><entry><para><literal>None</literal></para>
</entry>
</row><row><entry><para>Line pitch</para>
</entry><entry><para><literal>None</literal></para>
</entry>
</row><row><entry><para>Page width</para>
</entry><entry><para><literal>None</literal></para>
</entry>
</row><row><entry><para>Page length</para>
</entry><entry><para><literal>None</literal></para>
</entry>
</row><row><entry><para>Character set</para>
</entry><entry><para><literal>None</literal></para>
</entry>
</row><row><entry><para><command>stty</command> options</para>
</entry><entry><para><literal>9600 cs8 -cstopb -parenb -parodd ixon -ixany opost -olcuc onlcr
-ocrnl -onocr -onlret -ofill nl0 cr0 tab0 bs0 vt0 ff0</literal></para>
</entry>
</row><row><entry><para><indexterm id="printcust-ix724"><primary>exit codes (printer interface)</primary><secondary>standard</secondary></indexterm>Exit code </para>
</entry><entry><para><literal>0</literal></para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect3><sect3 id="printcust-13"><title>Customizing <command>stty</command> Modes</title><indexterm id="printcust-ix725"><primary>customizing</primary><secondary>stty modes</secondary>
</indexterm><para><indexterm id="printcust-ix726"><primary>terminal characteristics</primary></indexterm><indexterm id="printcust-ix727"><primary>stty settings</primary><secondary>customizing</secondary></indexterm><indexterm id="printcust-ix728"><primary>printer(s)</primary><secondary>stty settings</secondary></indexterm>If
you need to change the terminal characteristics, such as baud rate or output
options, find the section of the standard printer interface program that begins
with the following comment:</para><para><literal>## Initialize the printer port</literal></para><para>For more information, see the <olink targetptr="printcust-72543" remap="internal">Adjusting
Printer Port Characteristics</olink>.</para>
</sect3><sect3 id="printcust-14"><title>Exit Codes</title><indexterm id="printcust-ix729"><primary>exit codes (printer interface)</primary>
</indexterm><indexterm id="printcust-ix730"><primary>printer(s)</primary><secondary>interface program</secondary><tertiary>exit codes</tertiary>
</indexterm><indexterm id="printcust-ix731"><primary>customizing</primary><secondary>exit codes, printer</secondary>
</indexterm><para>When printing is complete, your interface program should exit with a
code that shows the status of the print job. The exit code is the last entry
in the printer interface program.</para><para><indexterm id="printcust-ix732"><primary>exit codes (printer interface)</primary><secondary>table of</secondary></indexterm><indexterm id="printcust-ix733"><primary>printer(s)</primary><secondary>interface program</secondary><tertiary>exit codes</tertiary></indexterm>The following table shows the exit codes and how
they are interpreted by the LP print service.</para><table frame="topbot" id="printcust-74466"><title>Printer Interface Program
Exit Codes</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="column1" colwidth="72*"/><colspec colname="column2" colwidth="288*"/><thead><row rowsep="1"><entry><para>Exit Code</para>
</entry><entry><para>Meaning to the LP Print Service</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>0</literal> </para>
</entry><entry><para>The print request has been successfully completed. If a printer fault
occurred, it has been cleared.</para>
</entry>
</row><row><entry><para><literal>1</literal> to <literal>127</literal></para>
</entry><entry><para>A problem was encountered when printing a request. For example, there
were too many nonprintable characters or the request exceeds the printer's
capabilities. The LP print service notifies the person who submitted the request
that an error occurred when printing it. This error does not affect future
print requests. If a printer fault has occurred, it has been cleared.</para>
</entry>
</row><row><entry><para><literal>128</literal></para>
</entry><entry><para>This code is reserved for use by the LP print service. Interface programs
must not exit with this code.</para>
</entry>
</row><row><entry><para><literal>129</literal></para>
</entry><entry><para>A printer fault was encountered when printing the request. This fault
does affect future print requests. If the fault recovery for the printer directs
the LP print service to wait for the administrator to correct the problem,
the LP print service disables the printer. If the fault recovery is to continue
printing, the LP print service does not disable the printer. However, the
print service will try printing again in a few minutes.</para>
</entry>
</row><row><entry><para><literal>&gt;129</literal></para>
</entry><entry><para>These codes are reserved for use by the LP print service. Interface
programs must not exit with codes in this range.</para>
</entry>
</row>
</tbody>
</tgroup>
</table><para>If the program exits with a code of 129, <literal>root</literal> is
alerted of a printer fault. The LP print service must also reprint the request
from the beginning, after the fault has been cleared. If you do not want the
entire request to be reprinted, you can have the interface program send a
fault message to the LP print service. (First wait for the fault to be cleared.)
When the fault is cleared, the interface program can resume printing the file.
When printing is finished, the printer interface program can give a <literal>0</literal> exit
code, just as if the fault had never occurred. An added advantage of this
approach: The interface program can detect when the fault is cleared automatically.
Thus, the administrator does not need to re-enable the printer.</para>
</sect3><sect3 id="printcust-15"><title>Fault Messages</title><indexterm id="printcust-ix734"><primary>printer(s)</primary><secondary>faults</secondary><tertiary>messages</tertiary>
</indexterm><para>You can use the <command>lp.tell</command> program to send fault messages
to the LP print service. This program is referenced by the <command>LPTELL</command> shell
variable in the standard printer interface code. The program takes standard
input and sends it to the LP print service. The LP print service puts standard
input into the message that alerts the administrator to the printer fault.
If its standard input is empty, the <command>lp.tell</command> program does
not initiate an alert. For an example of how the <command>lp.tell</command> program
is used, examine the standard printer interface code immediately after the
following comment:</para><para><literal># Set up the $LPTELL program to capture fault messages here</literal></para><para>If you use the special exit code <literal>129</literal> or the <command>lp.tell</command> program, the printer interface program does not need to disable
the printer itself. The interface program can disable the printer directly.
However, doing so overrides the fault-alerting mechanism. Alerts are sent
only if the LP print service detects that the printer has a fault, and the
special exit code and the <command>lp.tell</command> program are its main
detection tools.</para><para>If the LP print service has to interrupt printing of a file at any time,
it kills the interface program with a signal TERM (trap number 15). For more
information, see the <olink targetdoc="refman" targetptr="kill-1" remap="external"><citerefentry><refentrytitle>kill</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> and <olink targetdoc="refman" targetptr="signal-3c" remap="external"><citerefentry><refentrytitle>signal</refentrytitle><manvolnum>3C</manvolnum></citerefentry></olink> man pages. If the printer
interface program dies from receipt of any other signal, the LP print service
assumes that future print requests are not be affected. As a result, the LP
print service continues to use the printer. The LP print service notifies
the user who submitted the request that the request has not been finished
successfully.</para><para>When the interface is first invoked, the signals HUP, INT, QUIT, and
PIPE (trap numbers 1, 2, 3, and 13) are ignored. The standard interface changes
this default behavior, so that the signals are trapped at appropriate times.
The standard interface interprets receipt of these signals as warnings that
the printer has a problem. When the standard interface receives a signal,
it issues a fault alert.</para>
</sect3><sect3 id="printcust-16"><title>Using a Customized Printer Interface Program</title><para>You can create a customized printer interface program and use it instead
of the standard printer interface program on the print server. To do so, you
use the <command>lpadmin</command> command to register the program with the
LP print service for a specific printer.</para>
</sect3><task id="printcust-47894"><title>How to Set Up a Custom Printer Interface
Program</title><indexterm><primary>printer(s)</primary>
</indexterm><indexterm><primary>customizing</primary>
</indexterm><indexterm><primary>interface program (printer)</primary>
</indexterm><procedure><step id="printcust-step-18"><para>Log in as superuser, <literal>lp</literal>,
 or assume an equivalent role on the print server.</para>
</step><step id="printcust-step-20"><para><indexterm id="printcust-ix741"><primary>printer(s)</primary><secondary>interface program</secondary><tertiary>standard</tertiary></indexterm><indexterm id="printcust-ix742"><primary>interface program (printer)</primary><secondary>standard</secondary></indexterm><indexterm id="printcust-ix743"><primary>standard printer interface program</primary></indexterm>Copy the
standard printer interface program.</para><screen># <userinput>cp /var/spool/lp/model/standard</userinput>  <replaceable>custom-interface</replaceable></screen>
</step><step performance="optional"><para>If you already have a custom printer interface
program, go to  <olink targetptr="printcust-step-22" remap="internal">Step&nbsp;5</olink></para>
</step><step id="printcust-step-21"><para>Change the copy of the standard printer
interface program to meet your needs.</para><para>Refer to the description
of the program in <olink targetptr="printcust-52759" remap="internal">The Standard Printer
Interface Program</olink> to determine what you need to change.</para>
</step><step id="printcust-step-22"><para>Set up the custom printer interface program
for a specific printer.</para><screen># <userinput>lpadmin -p</userinput> <replaceable>printer-name</replaceable> <userinput>-i</userinput> <replaceable>custom-interface</replaceable></screen><variablelist><varlistentry><term><option>p</option></term><listitem><para>Specifies the printer that will use the custom printer interface
program.</para>
</listitem>
</varlistentry><varlistentry><term><option>i</option></term><listitem><para>Is the name of the custom printer interface program.</para>
</listitem>
</varlistentry>
</variablelist><para>The custom printer interface program is registered with the LP print
service, and will be used by that printer when users submit print requests.</para>
</step><step id="printcust-step-49"><para>Verify that the custom printer interface
program has been added in the <filename>/etc/lp/printers/</filename><replaceable>printer-name</replaceable><filename>/configuration</filename> file.</para>
</step>
</procedure><example id="emjhw"><title>Setting Up a Custom Printer Interface Program</title><para>This example shows how to set up a custom printer interface program
named <literal>custom</literal> for the printer <literal>luna</literal>.</para><screen># <userinput>lpadmin -p luna -i custom</userinput></screen>
</example><example id="emjiu"><title>Copying a Custom Printer Interface Program</title><para>This example shows how to copy a custom printer interface program from
the printer <literal>venus</literal> to the printer <literal>asteroid</literal>.</para><screen># <userinput>lpadmin -p asteroid -e venus</userinput></screen>
</example>
</task>
</sect2>
</sect1>
</chapter><?Pub *0000038894 0?>