/etc/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
af str NULL Name of accounting file
br num none If lp is a tty, set the baud rate (ioctl() call)
cf str NULL cifplot data filter
df str NULL TeX data filter (DVI format)
du str 0 Userid of user daemon
fc num 0 If lp is a tty, clear flag bits
ff str \f String to send for a form feed
fo bool false Print a form feed when device is opened
fs num 0 Similar to fc but set bits
gf str NULL Graph data filter (plot(3X) format)
hl bool false Print the burst header page last
ic bool false Driver supports (non standard) ioctl() to indent printout
if str NULL Name of input/communication filter (created per job)
lf str /dev/console Error logging filename
lo str lock Name of lock file
lp str /dev/lp Device name to open for output
mc num 0 Maximum number of copies
ms str NULL List of terminal modes to set or clear
mx num 1000 Maximum file size (in BUFSIZ blocks); zero = unlimited
nf str NULL ditroff data filter (device independent troff)
of str NULL Name of output/banner filter (created once)
pc num 200 Price per foot or page in hundredths of cents
pl num 66 Page length (in lines)
pw num 132 Page width (in characters)
px num 0 Page width in pixels (horizontal)
py num 0 Page length in pixels (vertical)
rf str NULL Filter for printing FORTRAN style text files
rg str NULL Restricted group - only members of group allowed access
rm str NULL Machine name for remote printer
rp str lp Remote printer name argument
rs bool false Restrict remote users to those with local accounts
rw bool false Open printer device read/write instead of write-only
sb bool false Short banner (one line only)
sc bool false Suppress multiple copies
sd str /usr/spool/output/lpd Spool directory
sf bool false Suppress form feeds
sh bool false Suppress printing of burst page header
st str status Status filename
tc str NULL Name of similar printer; must be last
tf str NULL troff data filter (C/A/T phototypesetter)
tr str NULL Trailer string to print when queue empties
vf str NULL Raster image filter
xc num 0 If lp is a tty, clear local mode bits
xs num 0 Like 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.