/usr.bin/pr/pr.1

https://bitbucket.org/freebsd/freebsd-head/ · Unknown · 395 lines · 395 code · 0 blank · 0 comment · 0 complexity · 1749eb8e016864a66640b19f8390fb6f MD5 · raw file

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