printcap

printer capability database

Name:

/etc/printcap

Description:

The printcap database is a simplified version of the termcap database for describing printers. The spooling system accesses the printcap file every time it's used, so printers can be added or deleted dynamically. Each entry in the database describes one printer.

Note that this database may not be substituted for — as is possible for termcap — because it may allow accounting to be bypassed.

The default printer is normally lp, though the environment variable PRINTER may be used to override this. Each spooling utility supports a -Pprinter option to explicitly name a destination printer.

Each entry in the printcap file describes a printer. An entry is a line consisting of a number of fields separated by : characters. The first entry for each printer gives the known names for the printer, separated by | characters.

The first name is conventionally a number. The second name is the most common abbreviation for the printer; the last name should be a long name fully identifying the printer. The second name should contain no blanks; the last name may well contain blanks for readability. Entries may continue onto multiple lines by giving a \ as the last character of a line. Empty fields may be included for readability.

Capabilities in printcap are all introduced by two-character codes and are of three types:

Capabilities:

Name:Type:Default:Description:
afstrNULLname of accounting file
brnumnoneif lp is a tty, set the baud rate (ioctl call)
dustr0userid of user daemon.
fcnum0if lp is a tty, clear flag bits
ffstr\fstring to send for a form feed
foboolfalseprint a form feed when device is opened
fsnum0like fc but set bits
hlboolfalseprint the burst header page last
ifstrNULLname of input/communication filter (created per job)
lfstr/dev/consoleerror logging filename
lostrlockname of lock file
lpstr/dev/lpdevice name to open for output
mcnum0maximum number of copies
msstrNULLlist of terminal modes to set or clear
mxnum1000maximum file size (in BUFSIZ blocks); zero = unlimited
ofstrNULLname of output/banner filter (created once)
pcnum200price per foot or page in hundredths of cents
plnum66page length (in lines)
pwnum132page width (in characters)
pxnum0page width in pixels (horizontal)
py num0page length in pixels (vertical)
rgstrNULLrestricted group — only members of group allowed access
rmstrNULLmachine name for remote printer
rpstrlp remote printer name argument
rsboolfalserestrict remote users to those with local accounts
rwboolfalseopen printer device read/write instead of write-only
sbboolfalseshort banner (one line only)
scboolfalsesuppress multiple copies
sdstr/usr/spool/output/lpdspool directory
sfboolfalsesuppress form feeds
shboolfalsesuppress printing of burst page header
ststrstatusstatus filename
tcstrNULLname of similar printer; must be last
trstrNULLtrailer string to print when queue empties
xcnum0if lp is a tty, clear local mode bits
xsnum0like xc but set bits

If the local line printer driver supports indentation, the daemon must understand how to invoke it.

Note that the fs, fc, xs, and xc fields are flag masks rather than values. Certain default device flags are set when the device is opened by the line printer daemon if the device is connected to a terminal port. The flags indicated in the fc field are then cleared; the flags in the fs field are then set (or vice versa, depending on the order of fc#nnnn and fs#nnnn in the /etc/printcap file).

The bits cleared by the fc field and set by the fs field are those in the sg_flags field of the sgtty structure, as set by the TIOCSETP ioctl() call, and the bits cleared by the xc field and set by the xs field are those in the “local flags” word, as set by the TIOCLSET ioctl() call. See ttcompat for a description of these flags.

For example, to set exactly the flags 06300 in the fs field, which specifies that the EVENP, ODDP, and XTABS modes are to be set and that all other flags are to be cleared, do:

:fc#0177777:fs#06300:

The same process applies to the xc and xs fields. Alternatively, the ms field can be used to specify modes to be set and cleared. These modes are specified as stty modes; any mode supported by stty may be specified, except for the baud rate (which must be specified with the br field). This lets you set or clear modes not supported by the older terminal interface described in ttcompat.

For example, to set the terminal port (to which the printer is attached) to even parity, TAB expansion, no NEWLINE to RETURN/LINEFEED translation, and RTS/CTS flow control enabled, do the following:

:ms=evenp,-tabs,nl,crtscts:

The tc field must appear last in the list of capabilities. Each type of printer should have a general entry describing common capabilities. Then an individual printer can be defined with its particular capabilities, plus a tc field that points to the general entry for that type of printer.

See also:

lpd, lpr, lprc, lprq, lprrm

Remote Printing Utilities chapter in this guide