137a342640bcc17c9b280c93254ba047af814816
[dragonfly.git] / usr.sbin / lpr / SMM.doc / 5.t
1 .\" Copyright (c) 1983, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)5.t 8.1 (Berkeley) 6/8/93
33 .\"
34 .NH 1
35 Output filter specifications
36 .PP
37 The filters supplied with 4.3BSD
38 handle printing and accounting for most common
39 line printers, the Benson-Varian, the wide (36") and
40 narrow (11") Versatec printer/plotters. For other devices or accounting
41 methods, it may be necessary to create a new filter.
42 .PP
43 Filters are spawned by \fIlpd\fP
44 with their standard input the data to be printed, and standard output
45 the printer.  The standard error is attached to the
46 .B lf
47 file for logging errors or \fIsyslogd\fP may be used for logging errors.
48 A filter must return a 0 exit
49 code if there were no errors, 1 if the job should be reprinted,
50 and 2 if the job should be thrown away.
51 When \fIlprm\fP
52 sends a kill signal to the \fIlpd\fP process controlling
53 printing, it sends a SIGINT signal 
54 to all filters and descendents of filters.
55 This signal can be trapped by filters that need
56 to do cleanup operations such as
57 deleting temporary files.
58 .PP
59 Arguments passed to a filter depend on its type.
60 The
61 .B of
62 filter is called with the following arguments.
63 .DS
64 \fIfilter\fP \fB\-w\fPwidth \fB\-l\fPlength
65 .DE
66 The \fIwidth\fP and \fIlength\fP values come from the
67 .B pw
68 and
69 .B pl
70 entries in the printcap database.
71 The
72 .B if
73 filter is passed the following parameters.
74 .DS
75 \fIfilter\fP [\|\fB\-c\fP\|] \fB\-w\fPwidth \fB\-l\fPlength \fB\-i\fPindent \fB\-n\fP login \fB\-h\fP host accounting_file
76 .DE
77 The
78 .B \-c
79 flag is optional, and only supplied when control characters
80 are to be passed uninterpreted to the printer (when using the
81 .B \-l
82 option of
83 .I lpr
84 to print the file).
85 The
86 .B \-w
87 and
88 .B \-l
89 parameters are the same as for the
90 .B of
91 filter.
92 The
93 .B \-n
94 and
95 .B \-h
96 parameters specify the login name and host name of the job owner.
97 The last argument is the name of the accounting file from
98 .IR printcap .
99 .PP
100 All other filters are called with the following arguments:
101 .DS
102 \fIfilter\fP \fB\-x\fPwidth \fB\-y\fPlength \fB\-n\fP login \fB\-h\fP host accounting_file
103 .DE
104 The
105 .B \-x
106 and
107 .B \-y
108 options specify the horizontal and vertical page
109 size in pixels (from the
110 .B px
111 and
112 .B py
113 entries in the printcap file).
114 The rest of the arguments are the same as for the
115 .B if
116 filter.