The filters supplied with 4.3BSD handle printing and accounting for most common line printers, the Benson-Varian, the wide (36") and narrow (11") Versatec printer/plotters. For other devices or accounting methods, it may be necessary to create a new filter.
Filters are spawned by lpd with their standard input the data to be printed, and standard output the printer. The standard error is attached to the lf file for logging errors or syslogd may be used for logging errors. A filter must return a 0 exit code if there were no errors, 1 if the job should be reprinted, and 2 if the job should be thrown away. When lprm sends a kill signal to the lpd process controlling printing, it sends a SIGINT signal to all filters and descendents of filters. This signal can be trapped by filters that need to do cleanup operations such as deleting temporary files.
Arguments passed to a filter depend on its type. The of filter is called with the following arguments.
filter -wwidth -llength
filter [-c] -wwidth -llength -iindent -n login -h host accounting_file
All other filters are called with the following arguments:
filter -xwidth -ylength -n login -h host accounting_file