xref: /netbsd-src/usr.bin/pr/pr.1 (revision 81e0d2b0af8485d94ed5da487d4253841a2e6e45)
1.\"	$NetBSD: pr.1,v 1.16 2003/10/13 07:41:22 agc Exp $
2.\"
3.\" Copyright (c) 1991 Keith Muller.
4.\" Copyright (c) 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" This code is derived from software contributed to Berkeley by
8.\" Keith Muller of the University of California, San Diego.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\" 3. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"     from: @(#)pr.1	8.1 (Berkeley) 6/6/93
35.\"	$NetBSD: pr.1,v 1.16 2003/10/13 07:41:22 agc Exp $
36.\"
37.Dd June 6, 1993
38.Dt PR 1
39.Os
40.Sh NAME
41.Nm pr
42.Nd print files
43.Sh SYNOPSIS
44.Nm
45.Bk -words
46.Op Ar \&+page
47.Ek
48.Bk -words
49.Op Fl Ar column
50.Ek
51.Op Fl adFmrt
52.Bk -words
53.Oo
54.Op Fl e
55.Op Ar char
56.Op Ar gap
57.Oc
58.Ek
59.Bk -words
60.Op Fl h Ar header
61.Ek
62.Bk -words
63.Oo
64.Op Fl i
65.Op Ar char
66.Op Ar gap
67.Oc
68.Ek
69.Bk -words
70.Op Fl l Ar lines
71.Ek
72.Bk -words
73.Op Fl o Ar offset
74.Ek
75.Bk -words
76.Oo
77.Op Fl s
78.Op Ar char
79.Oc
80.Ek
81.Bk -words
82.Op Fl T Ar timefmt
83.Ek
84.Bk -words
85.Oo
86.Op Fl n
87.Op Ar char
88.Op Ar width
89.Oc
90.Ek
91.Bk -words
92.Op Fl w Ar width
93.Ek
94.Op -
95.Op Ar file ...
96.Sh DESCRIPTION
97The
98.Nm
99utility is a printing and pagination filter for text files.
100When multiple input files are specified, each is read, formatted,
101and written to standard output.
102By default, the input is separated into 66-line pages, each with
103.sp
104.in +2
105.ti -2
106\(bu A 5-line header with the page number, date, time, and
107the pathname of the file.
108.sp
109.ti -2
110\(bu A 5-line trailer consisting of blank lines.
111.in -2
112.Pp
113If standard output is associated with a terminal,
114diagnostic messages are suppressed until the
115.Nm
116utility has completed processing.
117.Pp
118When multiple column output is specified,
119text columns are of equal width.
120By default text columns are separated by at least one
121.Em \*[Lt]blank\*[Gt] .
122Input lines that do not fit into a text column are truncated.
123Lines are not truncated under single column output.
124.Sh OPTIONS
125In the following option descriptions, column, lines, offset, page, and
126width are positive decimal integers and gap is a nonnegative decimal integer.
127.Bl -tag -width 4n
128.It Ar \&+page
129Begin output at page number
130.Ar page
131of the formatted input.
132.It Fl Ar column
133Produce output that is
134.Ar columns
135wide (default is 1) that is written vertically
136down each column in the order in which the text
137is received from the input file.
138The options
139.Fl e
140and
141.Fl i
142are assumed.
143This option should not be used with
144.Fl m .
145When used with
146.Fl t ,
147the minimum number of lines is used to display the output.
148.It Fl a
149Modify the effect of the
150.Fl column
151option so that the columns are filled across the page in a round-robin order
152(e.g., when column is 2, the first input line heads column
1531, the second heads column 2, the third is the second line
154in column 1, etc.).
155This option requires the use of the
156.Fl column
157option.
158.It Fl d
159Produce output that is double spaced. An extra
160.Em \*[Lt]newline\*[Gt]
161character is output following every \*[Lt]newline\*[Gt] found in the input.
162.It Fl e Ar \&[char\&]\&[gap\&]
163Expand each input \*[Lt]tab\*[Gt] to the next greater column
164position specified by the formula
165.Ar n*gap+1 ,
166where
167.Em n
168is an integer \*[Gt] 0.
169If
170.Ar gap
171is zero or is omitted the default is 8.
172All
173.Em \*[Lt]tab\*[Gt]
174characters in the input are expanded into the appropriate
175number of
176.Em \*[Lt]space\*[Gt]s .
177If any nondigit character,
178.Ar char ,
179is specified, it is used as the input tab character.
180.It Fl F
181Use a
182.Em \*[Lt]form-feed\*[Gt]
183character for new pages,
184instead of the default behavior that uses a
185sequence of
186.Em \*[Lt]newline\*[Gt]
187characters.
188.It Fl h Ar header
189Use the string
190.Ar header
191to replace the
192.Ar file name
193in the header line.
194.It Fl i Ar \&[char\&]\&[gap\&]
195In output, replace multiple \*[Lt]space\*[Gt]s with \*[Lt]tab\*[Gt]s whenever two or more
196adjacent \*[Lt]space\*[Gt]s reach column positions
197.Ar gap+1 ,
198.Ar 2*gap+1 ,
199etc.
200If
201.Ar gap
202is zero or omitted, default
203.Em \*[Lt]tab\*[Gt]
204settings at every eighth column position
205is used.
206If any nondigit character,
207.Ar char ,
208is specified, it is used as the output
209.Em \*[Lt]tab\*[Gt]
210character.
211.It Fl l Ar lines
212Override the 66 line default and reset the page length to
213.Ar lines .
214If
215.Ar lines
216is not greater than the sum of both the header and trailer
217depths (in lines), the
218.Nm
219utility suppresses output of both the header and trailer, as if the
220.Fl t
221option were in effect.
222.It Fl m
223Merge the contents of multiple files.
224One line from each file specified by a file operand is
225written side by side into text columns of equal fixed widths, in
226terms of the number of column positions.
227The number of text columns depends on the number of
228file operands successfully opened.
229The maximum number of files merged depends on page width and the
230per process open file limit.
231The options
232.Fl e
233and
234.Fl i
235are assumed.
236.It Fl n Ar \&[char\&]\&[width\&]
237Provide
238.Ar width
239digit line numbering.
240The default for
241.Ar width ,
242if not specified, is 5.
243The number occupies the first
244.Ar width
245column positions of each text column or each line of
246.Fl m
247output.
248If
249.Ar char
250(any nondigit character) is given, it is appended to the line number to
251separate it from whatever follows. The default for
252.Ar char
253is a
254.Em \*[Lt]tab\*[Gt] .
255Line numbers longer than
256.Ar width
257columns are truncated.
258.It Fl o Ar offset
259Each line of output is preceded by
260.Ar offset
261.Em \*[Lt]spaces\*[Gt]s .
262If the
263.Fl o
264option is not specified, the default is zero.
265The space taken is in addition to the output line width.
266.It Fl r
267Write no diagnostic reports on failure to open a file.
268.It Fl s Ar char
269Separate text columns by the single character
270.Ar char
271instead of by the appropriate number of
272.Em \*[Lt]space\*[Gt]s
273(default for
274.Ar char
275is the
276.Em \*[Lt]tab\*[Gt]
277character).
278.It Fl T
279Specify an
280.Xr strftime 3
281format string to be used to format the date and time information in the page
282header.
283.It Fl t
284Print neither the five-line identifying
285header nor the five-line trailer usually supplied for each page.
286Quit printing after the last line of each file without spacing to the
287end of the page.
288.It Fl w Ar width
289Set the width of the line to
290.Ar width
291column positions for multiple text-column output only.
292If the
293.Fl w
294option is not specified and the
295.Fl s
296option is not specified, the default width is 72.
297If the
298.Fl w
299option is not specified and the
300.Fl s
301option is specified, the default width is 512.
302.It Ar file
303A pathname of a file to be printed.
304If no
305.Ar file
306operands are specified, or if a
307.Ar file
308operand is
309.Sq Fl ,
310the standard input is used.
311The standard input is used only if no
312.Ar file
313operands are specified, or if a
314.Ar file
315operand is
316.Sq Fl .
317.El
318.Pp
319The
320.Fl s
321option does not allow the option letter to be separated from its
322argument, and the options
323.Fl e ,
324.Fl i ,
325and
326.Fl n
327require that both arguments, if present, not be separated from the option
328letter.
329.Sh ERRORS
330If
331.Nm
332receives an interrupt while printing to a terminal, it
333flushes all accumulated error messages to the screen before
334terminating.
335.Pp
336The
337.Nm
338utility exits 0 on success, and 1 if an error occurs.
339.Pp
340Error messages are written to standard error during the printing
341process (if output is redirected) or after all successful
342file printing is complete (when printing to a terminal).
343.Sh SEE ALSO
344.Xr cat 1 ,
345.Xr more 1 ,
346.Xr strftime 3
347.Sh STANDARDS
348The
349.Nm
350utility is
351.St -p1003.2
352compatible.
353