xref: /freebsd/usr.bin/pr/pr.1 (revision 6990ffd8a95caaba6858ad44ff1b3157d1efba8f)
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
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 L Ar locale
63.Ek
64.Bk -words
65.Op Fl h Ar header
66.Ek
67.Bk -words
68.Oo
69.Op Fl i
70.Op Ar char
71.Op Ar gap
72.Oc
73.Ek
74.Bk -words
75.Op Fl l Ar lines
76.Ek
77.Bk -words
78.Op Fl o Ar offset
79.Ek
80.Bk -words
81.Oo
82.Op Fl s
83.Op Ar char
84.Oc
85.Ek
86.Bk -words
87.Oo
88.Op Fl n
89.Op Ar char
90.Op Ar width
91.Oc
92.Ek
93.Bk -words
94.Op Fl w Ar width
95.Ek
96.Op -
97.Op Ar
98.Sh DESCRIPTION
99The
100.Nm
101utility is a printing and pagination filter for text files.
102When multiple input files are specified, each is read, formatted,
103and written to standard output.
104By default, the input is separated into 66-line pages, each with
105.Bl -bullet
106.It
107A 5-line header with the page number, date, time, and
108the pathname of the file.
109.It
110A 5-line trailer consisting of blank lines.
111.El
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 <blank> .
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.
160An extra
161.Em <newline>
162character is output following every
163.Em <newline>
164found in the input.
165.It Fl e Xo
166.Op Ar char Ns
167.Op Ar gap
168.Xc
169Expand each input
170.Em <tab>
171to the next greater column
172position specified by the formula
173.Ar n*gap+1 ,
174where
175.Em n
176is an integer > 0.
177If
178.Ar gap
179is zero or is omitted the default is 8.
180All
181.Em <tab>
182characters in the input are expanded into the appropriate
183number of
184.Em <space>s .
185If any nondigit character,
186.Ar char ,
187is specified, it is used as the input tab character.
188.It Fl F
189Use a
190.Em <form-feed>
191character for new pages,
192instead of the default behavior that uses a
193sequence of
194.Em <newline>
195characters.
196.It Fl h Ar header
197Use the string
198.Ar header
199to replace the
200.Ar file name
201in the header line.
202.It Fl i Xo
203.Op Ar char Ns
204.Op Ar gap
205.Xc
206In output, replace multiple
207.Em <space>s
208with
209.Em <tab>s
210whenever two or more
211adjacent
212.Em <space>s
213reach column positions
214.Ar gap+1 ,
215.Ar 2*gap+1 ,
216etc.
217If
218.Ar gap
219is zero or omitted, default
220.Em <tab>
221settings at every eighth column position
222is used.
223If any nondigit character,
224.Ar char ,
225is specified, it is used as the output
226.Em <tab>
227character.
228.It Fl L Ar locale
229Use
230.Ar locale
231specified as argument instead of one found in environment.
232Use "C" to reset locale to default.
233.It Fl l Ar lines
234Override the 66 line default and reset the page length to
235.Ar lines .
236If
237.Ar lines
238is not greater than the sum of both the header and trailer
239depths (in lines), the
240.Nm
241utility suppresses output of both the header and trailer, as if the
242.Fl t
243option were in effect.
244.It Fl m
245Merge the contents of multiple files.
246One line from each file specified by a file operand is
247written side by side into text columns of equal fixed widths, in
248terms of the number of column positions.
249The number of text columns depends on the number of
250file operands successfully opened.
251The maximum number of files merged depends on page width and the
252per process open file limit.
253The options
254.Fl e
255and
256.Fl i
257are assumed.
258.It Fl n Xo
259.Op Ar char Ns
260.Op Ar width
261.Xc
262Provide
263.Ar width
264digit line numbering.
265The default for
266.Ar width ,
267if not specified, is 5.
268The number occupies the first
269.Ar width
270column positions of each text column or each line of
271.Fl m
272output.
273If
274.Ar char
275(any nondigit character) is given, it is appended to the line number to
276separate it from whatever follows.
277The default for
278.Ar char
279is a
280.Em <tab> .
281Line numbers longer than
282.Ar width
283columns are truncated.
284.It Fl o Ar offset
285Each line of output is preceded by
286.Ar offset
287.Em <spaces>s .
288If the
289.Fl o
290option is not specified, the default is zero.
291The space taken is in addition to the output line width.
292.It Fl r
293Write no diagnostic reports on failure to open a file.
294.It Fl s Ar char
295Separate text columns by the single character
296.Ar char
297instead of by the appropriate number of
298.Em <space>s
299(default for
300.Ar char
301is the
302.Em <tab>
303character).
304.It Fl t
305Print neither the five-line identifying
306header nor the five-line trailer usually supplied for each page.
307Quit printing after the last line of each file without spacing to the
308end of the page.
309.It Fl w Ar width
310Set the width of the line to
311.Ar width
312column positions for multiple text-column output only.
313If the
314.Fl w
315option is not specified and the
316.Fl s
317option is not specified, the default width is 72.
318If the
319.Fl w
320option is not specified and the
321.Fl s
322option is specified, the default width is 512.
323.It Ar file
324A pathname of a file to be printed.
325If no
326.Ar file
327operands are specified, or if a
328.Ar file
329operand is
330.Sq Fl ,
331the standard input is used.
332The standard input is used only if no
333.Ar file
334operands are specified, or if a
335.Ar file
336operand is
337.Sq Fl .
338.El
339.Pp
340The
341.Fl s
342option does not allow the option letter to be separated from its
343argument, and the options
344.Fl e ,
345.Fl i ,
346and
347.Fl n
348require that both arguments, if present, not be separated from the option
349letter.
350.Sh ERRORS
351If
352.Nm
353receives an interrupt while printing to a terminal, it
354flushes all accumulated error messages to the screen before
355terminating.
356.Pp
357The
358.Nm
359utility exits 0 on success, and 1 if an error occurs.
360.Pp
361Error messages are written to standard error during the printing
362process (if output is redirected) or after all successful
363file printing is complete (when printing to a terminal).
364.Sh SEE ALSO
365.Xr cat 1 ,
366.Xr more 1
367.Sh STANDARDS
368The
369.Nm
370utility is
371.St -p1003.2
372compatible.
373.Sh HISTORY
374A
375.Nm
376command appeared in
377.At v1 .
378