/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 you can dynamically add or remove printers. Each entry in the database describes one printer.

Note that you can't replace this database—as you can for termcap—because that might allow accounting to be bypassed.

The default printer is normally lp, although you can use the environment variable PRINTER 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 these types:

Boolean
Indicates that the printer has some particular feature. Boolean capabilities are simply written between the : characters.
Numeric
Information such as baud rate, number of lines per page, and so on. Numeric capabilities are given by the two-character capability code followed by the # character, followed by the numeric value. The following example is a numeric entry stating that this printer should run at 1200 baud:
:br#1200:
String
A sequence that can be used to perform particular printer operations such as cursor motion. String-valued capabilities are given by the two-character capability code followed by an = sign and then a string ending at the next following :. For example:
:rp=spinwriter:

states that the remote printer is named spinwriter.

Capabilities

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

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 sgttyb 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 <sys/termio.h> 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, you can use the ms field to specify modes to be set and cleared. These modes are specified as stty modes; you can specify any mode supported by stty, except for the baud rate (which you must specify with the br field).

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.

For information about setting up the printcap file, see the Printing chapter of the QNX Neutrino User's Guide.