xref: /freebsd/usr.bin/pr/pr.1 (revision 67be1e195acfaec99ce4fffeb17111ce085755f7)
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. 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.Dd July 3, 2004
33.Dt PR 1
34.Os
35.Sh NAME
36.Nm pr
37.Nd print files
38.Sh SYNOPSIS
39.Nm
40.Bk -words
41.Op Ar \&+page
42.Ek
43.Bk -words
44.Op Fl Ar column
45.Ek
46.Op Fl adFfmprt
47.Bk -words
48.Oo
49.Op Fl e
50.Op Ar char
51.Op Ar gap
52.Oc
53.Ek
54.Bk -words
55.Op Fl L Ar locale
56.Ek
57.Bk -words
58.Op Fl h Ar header
59.Ek
60.Bk -words
61.Oo
62.Op Fl i
63.Op Ar char
64.Op Ar gap
65.Oc
66.Ek
67.Bk -words
68.Op Fl l Ar lines
69.Ek
70.Bk -words
71.Op Fl o Ar offset
72.Ek
73.Bk -words
74.Oo
75.Op Fl s
76.Op Ar char
77.Oc
78.Ek
79.Bk -words
80.Oo
81.Op Fl n
82.Op Ar char
83.Op Ar width
84.Oc
85.Ek
86.Bk -words
87.Op Fl w Ar width
88.Ek
89.Op -
90.Op Ar
91.Sh DESCRIPTION
92The
93.Nm
94utility is a printing and pagination filter for text files.
95When multiple input files are specified, each is read, formatted,
96and written to standard output.
97By default, the input is separated into 66-line pages, each with
98.Bl -bullet
99.It
100A 5-line header with the page number, date, time, and
101the pathname of the file.
102.It
103A 5-line trailer consisting of blank lines.
104.El
105.Pp
106If standard output is associated with a terminal,
107diagnostic messages are suppressed until the
108.Nm
109utility has completed processing.
110.Pp
111When multiple column output is specified,
112text columns are of equal width.
113By default text columns are separated by at least one
114.Em <blank> .
115Input lines that do not fit into a text column are truncated.
116Lines are not truncated under single column output.
117.Sh OPTIONS
118In the following option descriptions, column, lines, offset, page, and
119width are positive decimal integers and gap is a nonnegative decimal integer.
120.Bl -tag -width 4n
121.It Ar \&+page
122Begin output at page number
123.Ar page
124of the formatted input.
125.It Fl Ar column
126Produce output that is
127.Ar columns
128wide (default is 1) that is written vertically
129down each column in the order in which the text
130is received from the input file.
131The options
132.Fl e
133and
134.Fl i
135are assumed.
136This option should not be used with
137.Fl m .
138When used with
139.Fl t ,
140the minimum number of lines is used to display the output.
141(To columnify and reshape text files more generally and without additional
142formatting, see the
143.Xr rs 1
144utility.)
145.It Fl a
146Modify the effect of the
147.Fl column
148option so that the columns are filled across the page in a round-robin order
149(e.g., when column is 2, the first input line heads column
1501, the second heads column 2, the third is the second line
151in column 1, etc.).
152This option requires the use of the
153.Fl column
154option.
155.It Fl d
156Produce output that is double spaced.
157An extra
158.Em <newline>
159character is output following every
160.Em <newline>
161found in the input.
162.It Fl e Xo
163.Op Ar char Ns
164.Op Ar gap
165.Xc
166Expand each input
167.Em <tab>
168to the next greater column
169position specified by the formula
170.Ar n*gap+1 ,
171where
172.Em n
173is an integer > 0.
174If
175.Ar gap
176is zero or is omitted the default is 8.
177All
178.Em <tab>
179characters in the input are expanded into the appropriate
180number of
181.Em <space>s .
182If any nondigit character,
183.Ar char ,
184is specified, it is used as the input tab character.
185.It Fl F
186Use a
187.Em <form-feed>
188character for new pages,
189instead of the default behavior that uses a
190sequence of
191.Em <newline>
192characters.
193.It Fl f
194Same as
195.Fl F
196but pause before beginning the first page if standard output is a terminal.
197.It Fl h Ar header
198Use the string
199.Ar header
200to replace the
201.Ar file name
202in the header line.
203.It Fl i Xo
204.Op Ar char Ns
205.Op Ar gap
206.Xc
207In output, replace multiple
208.Em <space>s
209with
210.Em <tab>s
211whenever two or more
212adjacent
213.Em <space>s
214reach column positions
215.Ar gap+1 ,
216.Ar 2*gap+1 ,
217etc.
218If
219.Ar gap
220is zero or omitted, default
221.Em <tab>
222settings at every eighth column position
223is used.
224If any nondigit character,
225.Ar char ,
226is specified, it is used as the output
227.Em <tab>
228character.
229.It Fl L Ar locale
230Use
231.Ar locale
232specified as argument instead of one found in environment.
233Use "C" to reset locale to default.
234.It Fl l Ar lines
235Override the 66 line default and reset the page length to
236.Ar lines .
237If
238.Ar lines
239is not greater than the sum of both the header and trailer
240depths (in lines), the
241.Nm
242utility suppresses output of both the header and trailer, as if the
243.Fl t
244option were in effect.
245.It Fl m
246Merge the contents of multiple files.
247One line from each file specified by a file operand is
248written side by side into text columns of equal fixed widths, in
249terms of the number of column positions.
250The number of text columns depends on the number of
251file operands successfully opened.
252The maximum number of files merged depends on page width and the
253per process open file limit.
254The options
255.Fl e
256and
257.Fl i
258are assumed.
259.It Fl n Xo
260.Op Ar char Ns
261.Op Ar width
262.Xc
263Provide
264.Ar width
265digit line numbering.
266The default for
267.Ar width ,
268if not specified, is 5.
269The number occupies the first
270.Ar width
271column positions of each text column or each line of
272.Fl m
273output.
274If
275.Ar char
276(any nondigit character) is given, it is appended to the line number to
277separate it from whatever follows.
278The default for
279.Ar char
280is a
281.Em <tab> .
282Line numbers longer than
283.Ar width
284columns are truncated.
285.It Fl o Ar offset
286Each line of output is preceded by
287.Ar offset
288.Em <spaces>s .
289If the
290.Fl o
291option is not specified, the default is zero.
292The space taken is in addition to the output line width.
293.It Fl p
294Pause before each page if the standard output is a terminal.
295.Nm
296will write an alert character to standard error and wait for a carriage
297return to be read on the terminal.
298.It Fl r
299Write no diagnostic reports on failure to open a file.
300.It Fl s Ar char
301Separate text columns by the single character
302.Ar char
303instead of by the appropriate number of
304.Em <space>s
305(default for
306.Ar char
307is the
308.Em <tab>
309character).
310.It Fl t
311Print neither the five-line identifying
312header nor the five-line trailer usually supplied for each page.
313Quit printing after the last line of each file without spacing to the
314end of the page.
315.It Fl w Ar width
316Set the width of the line to
317.Ar width
318column positions for multiple text-column output only.
319If the
320.Fl w
321option is not specified and the
322.Fl s
323option is not specified, the default width is 72.
324If the
325.Fl w
326option is not specified and the
327.Fl s
328option is specified, the default width is 512.
329.It Ar file
330A pathname of a file to be printed.
331If no
332.Ar file
333operands are specified, or if a
334.Ar file
335operand is
336.Sq Fl ,
337the standard input is used.
338The standard input is used only if no
339.Ar file
340operands are specified, or if a
341.Ar file
342operand is
343.Sq Fl .
344.El
345.Pp
346The
347.Fl s
348option does not allow the option letter to be separated from its
349argument, and the options
350.Fl e ,
351.Fl i ,
352and
353.Fl n
354require that both arguments, if present, not be separated from the option
355letter.
356.Sh EXIT STATUS
357.Ex -std
358.Sh DIAGNOSTICS
359If
360.Nm
361receives an interrupt while printing to a terminal, it
362flushes all accumulated error messages to the screen before
363terminating.
364.Pp
365Error messages are written to standard error during the printing
366process (if output is redirected) or after all successful
367file printing is complete (when printing to a terminal).
368.Sh SEE ALSO
369.Xr cat 1 ,
370.Xr more 1 ,
371.Xr rs 1
372.Sh STANDARDS
373The
374.Nm
375utility is
376.St -p1003.1-2001
377compatible.
378.Sh HISTORY
379A
380.Nm
381command appeared in
382.At v1 .
383.Sh BUGS
384The
385.Nm
386utility does not recognize multibyte characters.
387