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