PRINTCAP(5)

NAME
printcap - printer capability data base

SYNOPSIS
printcap

DESCRIPTION
The printcap data base is a simplified version of the termcap(5) data base used to describe line printers. The spooling system accesses the printcap file every time it is used, allowing dynamic addition and deletion of printers. Each entry in the data base is used to describe one printer. This data base may not be substituted for, as is possible for termcap(5), 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 an option, -P printer, to allow explicit naming of a destination printer.

Refer to the for a complete discussion on how to set up the database for a given printer.

CAPABILITIES
Refer to termcap(5) for a description of the file layout.
Name Type Default Description
af | str | NULL | name of accounting file
br | num | none | if lp is a tty, set the baud rate
(ioctl(2) call)
cf | str | NULL | cifplot data filter
df | str | NULL | tex data filter
(DVI format)
fc | num | 0 | if lp is a tty, clear flag bits
(sgtty.h)
ff | str | ‘\f’ | string to send for a form feed
fo | bool | false | print a form feed when device is opened
fs | num | 0 | like `fc' but set bits
gf | str | NULL | graph data filter
(plot(3) 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 text filter which does accounting
lf | str | /dev/console | error logging file name
lo | str | lock | name of lock file
lp | str | /dev/lp | device name to open for output to local printer, or port@host for remote printer/printer on print server
ms | str | NULL | list of terminal modes to set or clear
mx | num | 1000 | maximum file size (in
BUFSIZ blocks), zero = unlimited
nd | str | NULL | next directory for list of queues (unimplemented)
nf | str | NULL | ditroff data filter (device independent troff)
of | str | NULL | name of output filtering program
pc | num | 200 | price per foot or page in hundredths of cents
pf | str | NULL | filter for printing
PostScript files
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 or port@host for a remote printer on a port other than the standard port.
( also suppress the burst page, see NOTES)
rp | str | ``lp'' | remote printer name argument
rs | bool | false | restrict remote users to those with local accounts
rw | bool | false | open the printer device for reading and writing
sb | bool | false | short banner (one line only)
sc | bool | false | suppress multiple copies
sd | str | /var/spool/output/lpd | spool directory
sf | bool | false | suppress form feeds
sh | bool | false | suppress printing of burst page header
( local only, see NOTES)
st | str | status | status file name
tf | str | NULL | troff data filter (cat 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
(tty(4))
xs | num | 0 | like `xc' but set bits

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

FILTERS
If a printer is specified via lp (either local or remote), the lpd(8) daemon creates a pipeline of filters to process files for various printer types. The pipeline is not set up for remote printers specified via rm unless the local host is the same as the remote printer host given. The filters selected depend on the flags passed to lpr(1). The pipeline set up is:

    p	pr | if	regular text + pr(1)
    none	if	regular text
    c	cf	cifplot
    d	df	DVI (tex)
    g	gf	plot(3)
    n	nf	ditroff
    o	pf	PostScript
    f	rf	Fortran
    t	tf	troff
    v	vf	raster image

The if filter is invoked with arguments:

if [-c] -wwidth -llength -iindent -n login [-j jobname] -h host acct-file

The -c flag is passed only if the -l flag (pass control characters literally) is specified to lpr(1). The width and length specify the page width and length (from pw and pl respectively) in characters. The -n and -h parameters specify the login name and host name of the owner of the job respectively. The -j parameter is optional and specifies the name of the print job if available. The acct-file option is passed from the af printcap entry.

If no if is specified, of is used instead, with the distinction that of is opened only once, while if is opened for every individual job. Thus, if is better suited to performing accounting. The of is only given the width and length flags.

All other filters are called as:

filter -xwidth -ylength -n login [-j jobname] -h host acct-file

where width and length are represented in pixels, specified by the px and py entries respectively.

All filters take stdin as the file, stdout as the printer, may log either to stderr or using syslog(3), and must not ignore SIGINT.

Filters can communicate errors to lpd by their exit code and by modifying the mode of the spool lock file as follows:
Exit code
    Description
0   Success.
1   An attempt is made to reprint the job and mail is sent if it fails.
2   lpd(8) silently discards the job.
n   lpd(8) discards the job and mail is sent.
lock code
    Description
u+x Stop printing and leave queue disabled (S_IXUSR).
o+x Rebuild the queue (S_IXOTH).

LOGGING
Error messages generated by the line printer programs themselves (that is, the lp* programs) are logged by syslog(3) using the LPR facility. Messages printed on stderr of one of the filters are sent to the corresponding lf file. The filters may, of course, use syslog(3) themselves.

Error messages sent to the console have a carriage return and a line feed appended to them, rather than just a line feed.

SEE ALSO
lpq(1), lpr(1), lprm(1), termcap(5), lpc(8), lpd(8), pac(8) 4.3 BSD Line Printer Spooler Manual.

NOTES
The sh flag is a function of the spooler with the locally attached printer, and so has no effect when used with rm. NetBSD never adds a burst page when used as a remote spooler. To suppress the burst page for other systems or dedicated devices, refer to the documentation for those systems or devices.

HISTORY
The printcap file format appeared in 4.2BSD.