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