The LP print service uses an interface program and the terminfo database to initialize each printer and establish a selected page size, character pitch, line pitch, and character set.
Each printer is identified in the terminfo database with a short name. The name required by the terminfo database is identical to the name used to set the TERM shell variable. This name is also the printer type you specify when setting up a printer. For example, the entries for different types of PostScript printers are in the /usr/share/lib/terminfo/P directory. The default entries provided with the SunOS release are PS (for PostScript) and PSR (for PostScript Reverse).
If you cannot find a terminfo 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.
If there is no terminfo entry for your type of printer and you want to keep the printer set in the correct modes, you can either customize the interface program used with the printer or add an entry to the terminfo database. A terminal or printer entry in the terminfo 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 terminfo items for a printer.
Table 7–2 Required terminfo Items for a Printer
Item |
|
Meaning |
---|---|---|
Booleans: |
|
|
|
cpix |
Changing character pitch changes resolution |
|
daisy |
Printer requires an operator to change character set |
|
lpix |
Changing line pitch changes resolution |
Numbers: |
|
|
|
bufsx |
Number of bytes buffered before printing |
|
cols |
Number of columns in a line |
|
cps |
Average print rate in characters per second |
|
it |
Tabs initially every n spaces |
|
lines |
Number of lines on a page |
|
orc |
Horizontal resolution, in units per character |
|
orhi |
Horizontal resolution, in units per inch |
|
orl |
Vertical resolution, in units per line |
|
orvi |
Vertical resolution, in units per inch |
Strings: |
|
|
|
chr |
Change horizontal resolution |
|
cpi |
Change number of characters per inch |
|
cr |
Carriage return |
|
csnm |
List of character set names |
|
cudl |
Down one line |
|
cud |
Move carriage down n lines |
|
cuf |
Move carriage right n columns |
|
cvr |
Change vertical resolution |
|
ff |
Page eject |
|
hpa |
Horizontal position absolute |
|
ht |
Tab to next 8-space tab stop |
|
if |
Name of initialization file |
|
iprog |
Path name of initialization program |
|
is1 |
Printer initialization string |
|
is2 |
Printer initialization string |
|
is3 |
Printer initialization string |
Strings: |
|
|
|
lpi |
Change number of lines per inch |
|
mgc |
Clear all margins (top, bottom, and sides) |
|
rep |
Repeat a character n times |
|
rwidm |
Disable double-wide printing |
|
scs |
Select character set |
|
scsd |
Start definition of a character set |
|
slines |
Set page length to n lines per page |
|
smgl |
Set left margin at current column |
|
smglp |
Set left margin |
|
smgr |
Set right margin at current column |
|
smgrp |
Set right margin |
|
smglr |
Set both left and right margins |
|
msgt |
Set top margin at current line |
|
smgtp |
Set top margin |
|
smgb |
Set bottom margin at current line |
|
smgbp |
Set bottom margin |
|
smgtb |
Set both top and bottom margins |
|
swidm |
Enable double-wide printing |
|
vpa |
Vertical position absolute |
Before you create a terminfo entry for a printer, you should first make sure none of the existing terminfo entries will support the printer. To do so, try to set up the printer with an entry for a similar printer, if there is one.
Log in as superuser, lp, or assume an equivalent role on the print server.
Determine a terminfo entry name for the printer.
The directories in the /usr/share/lib/terminfo directory contain all the valid terminfo entries. Use them as a guide for choosing a name for the printer.
Create a terminfo entry file for the printer.
Table 7–2 shows the items you must define in the terminfo entry to add a new printer to the LP print service. For more details about the structure of the terminfo database, see terminfo(4).
To help you start writing a new terminfo entry, use the infocmp command to save an existing terminfo entry to a file. This is helpful if there is a terminfo entry that is similar to one you want to create. For example, the following command saves the ps entry to the ps_cust file, which will become the new terminfo entry.
infocmp ps > ps_cust
Compile the terminfo entry file into the terminfo database.
# tic terminfo_entry |
terminfo_entry |
The terminfo entry file you created. |
Check for the new terminfo entry file in the /usr/share/lib/terminfo directory.