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