Specifications

6-21
System V Printer Configuration
signals other than the dropping of a carrier or the shutting off of data flow. A filter can serve
you by detecting more faults and providing more information about them than you would
otherwise receive.
A filter can wait for a printer fault to clear and then resume printing. This service allows for
more efficient printing when a fault occurs because the print request that was interrupted
does not have to be reprinted in its entirety. Only a real filter, which has knowledge of the
control sequences used by a printer, can know where a file breaks into pages. Thus only
such a filter can find the place in the file where printing should resume.
The print service has an interface that allows a filter to send you fault information and to
restart printing if it can. The alerting mechanism (see Setting Up Printer Fault Alerts on page
6-40) is handled by the print service; the interface program that manages the filter takes all
error messages from the filter and places them in an alert message that can be sent to you.
If you have set the printer configuration so that printing should automatically resume after a
fault is cleared, the interface program keeps the filter active, so that printing can pick up
where it left off.
What Programs Make Good Filters
It is tempting to use a program such as troff, nroff, or a similar word–processing program
as a filter. However, the troff and nroff programs have a feature that allows references to
be made in a source file to other files, known as include files. The print service does not
recognize include files; it will not enqueue any that are referenced by a source file when that
file is in a queue to be printed. As a result, the troff or nroff program, unable to access the
include files, may fail. Other programs may have similar features that limit their use as
filters.
Here are a few guidelines for evaluating a program for use as a filter:
Only programs capable of reading data from standard input and writing data to standard
output may be used as filters.
Examine the kinds of files users will submit for printing that will require processing by the
program. A good program is one that stands alone (that is, it does not need to refer to
other files).
Determine if the program expects any files other than those submitted by a user for
printing. If it does, those files must be in the directory of the person using the filter, or
they must be readable by all users authorized to use the filter. The latter prerequisite is
necessary because filters are run with the user ID and group ID of the user who
submitted the print request.
If referenced files are permitted in the files submitted for printing, or if the program will
need files other than those submitted by a user, then the program, unable to access the
additional files, is likely to fail. Rather than using the program under consideration as a
filter; instead, have users run the program before submitting files for printing.
Referenced files that are always specified by full pathnames may be acceptable, but only if
the filter is used for local print requests. When used on requests submitted from a remote
machine for printing on your machine, the filter may still fail if the referenced files exist only
on the remote machine.
Defining a Filter
When adding a new filter, you must define the characteristics of its use. To do this, issue the
lpfilter command with arguments that specify the values of the following filter
characteristics:
Name of the filter (that is, a command name)
Types of input it will accept
Types of output it will produce
Types of printers to which it will send jobs