Annotation of src/usr.bin/fmt/fmt.1, Revision 1.13
1.13 ! jakob 1: .\" $OpenBSD: fmt.1,v 1.12 2001/09/05 16:33:34 jakob Exp $
1.1 deraadt 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. All advertising materials mentioning features or use of this software
15: .\" must display the following acknowledgement:
16: .\" This product includes software developed by the University of
17: .\" California, Berkeley and its contributors.
18: .\" 4. Neither the name of the University nor the names of its contributors
19: .\" may be used to endorse or promote products derived from this software
20: .\" without specific prior written permission.
21: .\"
22: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: .\" SUCH DAMAGE.
33: .\"
34: .\" @(#)fmt.1 8.1 (Berkeley) 6/6/93
35: .\"
1.4 millert 36: .\" Modified by Gareth McCaughan to describe the new version of `fmt'
37: .\" rather than the old one.
1.1 deraadt 38: .Dd June 6, 1993
39: .Dt FMT 1
40: .Os
41: .Sh NAME
42: .Nm fmt
43: .Nd simple text formatter
44: .Sh SYNOPSIS
1.6 aaron 45: .Nm fmt
1.4 millert 46: .Op Fl cmps
47: .Op Fl d Ar chars
48: .Op Fl l Ar num
49: .Op Fl t Ar num
1.1 deraadt 50: .Oo
51: .Ar goal
52: .Op Ar maximum
1.10 pjanzen 53: |
54: .Fl Ns Ar width |
55: .Fl w Ar width
1.1 deraadt 56: .Oc
1.10 pjanzen 57: .Op Ar file ...
1.1 deraadt 58: .Sh DESCRIPTION
1.7 aaron 59: .Nm
1.1 deraadt 60: is a simple text formatter which reads the concatenation of input
61: files (or standard input if none are given) and produces on standard
62: output a version of its input with lines as close to the
63: .Ar goal
64: length
1.4 millert 65: as possible without exceeding the
1.5 aaron 66: .Ar maximum .
1.4 millert 67: The
1.1 deraadt 68: .Ar goal
69: length defaults
1.4 millert 70: to 65 and the
71: .Ar maximum
1.9 aaron 72: to 10 more than the goal length.
1.10 pjanzen 73: Alternatively, a single
74: .Ar width
75: parameter can be specified either by prepending a hyphen to it or by using
76: .Fl w .
77: For example,
78: .Dl fmt -w 72 ,
79: .Dl fmt -72 ,
80: and
81: .Dl fmt 72 72
82: all produce identical output.
1.9 aaron 83: The spacing at the beginning of the input lines is preserved in the output,
84: as are blank lines and interword spacing.
1.10 pjanzen 85: Lines are joined or split only at white space; that is, words are never
86: joined or hyphenated.
1.3 millert 87: .Pp
1.8 aaron 88: The options are as follows:
1.11 aaron 89: .Bl -tag -width Ds
1.4 millert 90: .It Fl c
1.9 aaron 91: Center the text, line by line.
92: In this case, most of the other
1.4 millert 93: options are ignored; no splitting or joining of lines is done.
94: .It Fl m
95: Try to format mail header lines contained in the input sensibly.
96: .It Fl p
1.9 aaron 97: Allow indented paragraphs.
98: Without the
1.4 millert 99: .Fl p
100: flag, any change in the amount of whitespace at the start of a line
101: results in a new paragraph being begun.
102: .It Fl s
103: Collapse whitespace inside lines, so that multiple whitespace
104: characters are turned into a single space. (Or, at the end of a
105: sentence, a double space.)
106: .It Fl d Ar chars
107: Treat the
108: .Ar chars
1.9 aaron 109: (and no others) as sentence-ending characters.
110: By default the
1.4 millert 111: sentence-ending characters are full stop, question mark and
1.9 aaron 112: exclamation mark.
113: Remember that some characters may need to be
1.4 millert 114: escaped to protect them from your shell.
115: .It Fl l Ar number
116: Replace multiple spaces with tabs at the start of each output
117: line, if possible.
118: .Ar number
119: spaces will be replaced with one tab.
120: .It Fl t Ar number
121: Assume that the input files' tabs assume
122: .Ar number
1.9 aaron 123: spaces per tab stop.
124: The default is 8.
1.4 millert 125: .El
1.1 deraadt 126: .Pp
1.7 aaron 127: .Nm
1.1 deraadt 128: is meant to format mail messages prior to sending, but may also be useful
129: for other simple tasks.
130: For instance,
131: within visual mode of the
132: .Xr ex 1
1.7 aaron 133: editor (e.g.,
1.1 deraadt 134: .Xr vi 1 )
135: the command
136: .Pp
137: .Dl \&!}fmt
138: .Pp
139: will reformat a paragraph,
140: evening the lines.
141: .Sh SEE ALSO
1.4 millert 142: .Xr mail 1 ,
143: .Xr nroff 1
1.1 deraadt 144: .Sh HISTORY
1.13 ! jakob 145: An
1.4 millert 146: .Nm
1.1 deraadt 147: command appeared in
148: .Bx 3 .
1.4 millert 149: .Pp
150: The version described herein is a complete rewrite and appeared in
1.9 aaron 151: .Ox 2.4 .
1.1 deraadt 152: .\" .Sh AUTHOR
153: .\" Kurt Shoens
154: .\" .br
155: .\" Liz Allen (added goal length concept)
1.4 millert 156: .\" The above are the authors of the old `fmt' program;
157: .\" the present one was written by Gareth McCaughan.
1.1 deraadt 158: .Sh BUGS
159: The program was designed to be simple and fast \- for more complex
160: operations, the standard text processors are likely to be more appropriate.
1.4 millert 161: .Pp
162: When the first line of an indented paragraph is very long (more than
163: about twice the goal length), the indentation in the output can be
164: wrong.
165: .Pp
166: .Nm
167: is not infallible in guessing what lines are mail headers and what
168: lines are not.