logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

fmt.1 (5591B)


  1. .\" $OpenBSD: fmt.1,v 1.30 2016/10/24 13:46:58 schwarze Exp $
  2. .\"
  3. .\" Copyright (c) 1980, 1990, 1993
  4. .\" The Regents of the University of California. All rights reserved.
  5. .\"
  6. .\" Redistribution and use in source and binary forms, with or without
  7. .\" modification, are permitted provided that the following conditions
  8. .\" are met:
  9. .\" 1. Redistributions of source code must retain the above copyright
  10. .\" notice, this list of conditions and the following disclaimer.
  11. .\" 2. Redistributions in binary form must reproduce the above copyright
  12. .\" notice, this list of conditions and the following disclaimer in the
  13. .\" documentation and/or other materials provided with the distribution.
  14. .\" 3. Neither the name of the University nor the names of its contributors
  15. .\" may be used to endorse or promote products derived from this software
  16. .\" without specific prior written permission.
  17. .\"
  18. .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  19. .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  22. .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24. .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25. .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26. .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27. .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. .\" SUCH DAMAGE.
  29. .\"
  30. .\" @(#)fmt.1 8.1 (Berkeley) 6/6/93
  31. .\"
  32. .Dd $Mdocdate: October 24 2016 $
  33. .Dt FMT 1
  34. .Os
  35. .Sh NAME
  36. .Nm fmt
  37. .Nd simple text formatter
  38. .Sh SYNOPSIS
  39. .Nm fmt
  40. .Op Fl cmnps
  41. .Op Fl d Ar chars
  42. .Op Fl l Ar number
  43. .Op Fl t Ar number
  44. .Op Ar goal Oo Ar maximum Oc | Fl Ar width | Fl w Ar width
  45. .Op Ar
  46. .Sh DESCRIPTION
  47. .Nm
  48. is a simple text formatter which reads the concatenation of input
  49. files (or standard input if none are given) and produces on standard
  50. output a version of its input with lines as close to the
  51. .Ar goal
  52. length
  53. as possible without exceeding the
  54. .Ar maximum .
  55. The
  56. .Ar goal
  57. length defaults
  58. to 65 and the
  59. .Ar maximum
  60. to 10 more than the
  61. .Ar goal
  62. length.
  63. .Pp
  64. Alternatively, a single
  65. .Ar width
  66. parameter can be specified either by prepending a hyphen to it or by using
  67. .Fl w .
  68. For example,
  69. .Dq fmt -w 72 ,
  70. .Dq fmt -72 ,
  71. and
  72. .Dq fmt 72 72
  73. all produce identical output.
  74. The spacing at the beginning of the input lines is preserved in the output,
  75. as are blank lines and interword spacing.
  76. Lines are joined or split only at white space; that is, words are never
  77. joined or hyphenated.
  78. .Pp
  79. The options are as follows:
  80. .Bl -tag -width Ds
  81. .It Fl c
  82. Center the text, line by line.
  83. In this case, most of the other
  84. options are ignored; no splitting or joining of lines is done.
  85. .It Fl d Ar chars
  86. Treat
  87. .Ar chars
  88. (and no others) as sentence-ending characters.
  89. By default the
  90. sentence-ending characters are full stop
  91. .Pq Ql \&. ,
  92. question mark
  93. .Pq Ql \&? ,
  94. and exclamation mark
  95. .Pq Ql \&! .
  96. Remember that some characters may need to be
  97. escaped to protect them from the shell.
  98. .It Fl l Ar number
  99. Replace multiple spaces with tabs at the start of each output
  100. line, if possible.
  101. .Ar number
  102. spaces will be replaced with one tab.
  103. .It Fl m
  104. Try to format mail header lines contained in the input sensibly.
  105. .It Fl n
  106. Format lines beginning with a
  107. .Ql \&.
  108. (dot) character.
  109. Normally,
  110. .Nm
  111. does not fill these lines,
  112. for compatibility with troff and nroff.
  113. .It Fl p
  114. Allow indented paragraphs.
  115. Without the
  116. .Fl p
  117. flag, any change in the amount of whitespace at the start of a line
  118. results in a new paragraph being begun.
  119. .It Fl s
  120. Collapse whitespace inside lines, so that multiple whitespace
  121. characters are turned into a single space
  122. (or, at the end of a
  123. sentence, a double space).
  124. .It Fl t Ar number
  125. Assume that the input files' tabs assume
  126. .Ar number
  127. spaces per tab stop.
  128. The default is 8.
  129. .El
  130. .Pp
  131. .Nm
  132. is meant to format mail messages prior to sending, but may also be useful
  133. for other simple tasks.
  134. For instance,
  135. within an editor such as
  136. .Xr vi 1 ,
  137. the following command
  138. will reformat a paragraph,
  139. evening the lines:
  140. .Pp
  141. .Dl !}fmt
  142. .Sh ENVIRONMENT
  143. .Bl -tag -width LC_CTYPE
  144. .It Ev LC_CTYPE
  145. The character encoding
  146. .Xr locale 1 .
  147. It decides which byte sequences form characters
  148. and what their display width is.
  149. If unset or set to
  150. .Qq C ,
  151. .Qq POSIX ,
  152. or an unsupported value, each byte except the tab
  153. is treated as a character of display width 1.
  154. .El
  155. .Sh EXIT STATUS
  156. .Ex -std
  157. The latter happens with invalid options, insufficient memory,
  158. or when an input file is not found or not readable.
  159. The >0 exit value is the sum of all errors up to a maximum of 127;
  160. more errors may occur but the counter will only increment to this number.
  161. .Sh SEE ALSO
  162. .Xr indent 1 ,
  163. .Xr mail 1 ,
  164. .Xr vi 1
  165. .Sh HISTORY
  166. The
  167. .Nm
  168. command first appeared in
  169. .Bx 2 .
  170. .Pp
  171. The version described herein is a complete rewrite and appeared in
  172. .Ox 2.4 .
  173. .Sh AUTHORS
  174. .An Kurt Shoens
  175. (July 1978)
  176. .An Liz Allen
  177. (added goal length concept)
  178. .An Gareth McCaughan
  179. (wrote this version)
  180. .Sh BUGS
  181. The program was designed to be simple and fast \(en for more complex
  182. operations, the standard text processors are likely to be more appropriate.
  183. .Pp
  184. When the first line of an indented paragraph is very long (more than
  185. about twice the goal length), the indentation in the output can be
  186. wrong.
  187. .Pp
  188. .Nm
  189. is not infallible in guessing what lines are mail headers and what
  190. lines are not.