Adding a terminfo Entry for an Unsupported Printer

The LP print service uses an interface program and the terminfo database to initialize each printer and establish the following:

Each printer is identified in the terminfo database with a short name. The short 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 that 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 software 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 no terminfo 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:

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 6.2. Required terminfo Items for a Printer (Booleans)

Item

Description

Booleans:

cpix

Changing character pitch changes resolution

daisy

Printer requires an operator to change character set

lpix

Changing line pitch changes resolution

Table 6.3. Required terminfo Items for a Printer (Numbers)

Item

Description

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

Table 6.4. Required terminfo Items for a Printer (Strings)

Item

Description

Strings:

chr

Changes horizontal resolution

cpi

Changes number of characters per inch

cr

Carriage return

csnm

List of character set names

cudl

Moves carriage down one line

cud

Moves carriage down n lines

cuf

Moves carriage to the right n columns

cvr

Changes vertical resolution

ff

Ejects page

hpa

Horizontal position absolute

ht

Tabs to next 8-space tab stop

if

Is the name of initialization file

iprog

Is the path name of initialization program

is1

Is a printer initialization string

is2

Is a printer initialization string

is3

Is a printer initialization string

lpi

Changes number of lines per inch

mgc

Clears all margins (top, bottom, and sides)

rep

Repeats a character n times

rwidm

Disables double-wide printing

scs

Selects character set

scsd

Starts definition of a character set

slines

Set page length to n lines per page

smgl

Sets left margin at current column

smglp

Set left margin

smgr

Sets right margin at current column

smgrp

Sets right margin

smglr

Sets both left and right margins

msgt

Sets top margin at current line

smgtp

Sets top margin

smgb

Sets bottom margin at current line

smgbp

Sets bottom margin

smgtb

Sets both top and bottom margins

swidm

Enables double-wide printing

vpa

Sets vertical position to absolute

How to Add a terminfo Entry for an Unsupported Printer

Note

Before you create a terminfo entry for a printer, make sure that 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 a similar printer exists.

  1. Log in as superuser, lp, or assume an equivalent role on the print server.

  2. Determine a terminfo entry name for the printer.

    The directories in the /usr/share/lib/terminfo directory contain all the valid terminfo entries. Use these entries as a guide for choosing a name for the printer.

  3. Create a terminfo entry file for the printer.

    Table 6–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 the terminfo ( 4 ) man page.

    To help you start writing a new terminfo entry, use the infocmp command to save an existing terminfo entry to a file. This command is helpful if there is a terminfo entry that is similar to entry 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

  4. Compile the terminfo entry file into the terminfo database.

    # tic terminfo_entry
    

    where terminfo-entry variable is the terminfo entry file you created.

  5. Check for the new terminfo entry file in the /usr/share/lib/terminfo directory.