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