Remove advertising header from man pages.
[dragonfly.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: src/usr.bin/fmt/fmt.1,v 1.7.2.3 2002/06/21 15:26:55 charnier Exp $
30 .\" $DragonFly: src/usr.bin/fmt/fmt.1,v 1.3 2007/07/29 17:27:45 swildner Exp $
31 .\"
32 .\" Modified by Gareth McCaughan to describe the new version of `fmt'
33 .\" rather than the old one.
34 .Dd June 25, 2000
35 .Dt FMT 1
36 .Os
37 .Sh NAME
38 .Nm fmt
39 .Nd simple text formatter
40 .Sh SYNOPSIS
41 .Nm
42 .Op Fl cmnps
43 .Op Fl d Ar chars
44 .Op Fl l Ar num
45 .Op Fl t Ar num
46 .Op Ar goal Oo Ar maximum Oc | Fl Ns Ar width | Fl w Ar width
47 .Op Ar
48 .Sh DESCRIPTION
49 The
50 .Nm
51 utility is a simple text formatter which reads the concatenation of input
52 files (or standard input if none are given) and produces on standard
53 output a version of its input with lines as close to the
54 .Ar goal
55 length
56 as possible without exceeding the
57 .Ar maximum .
58 The
59 .Ar goal
60 length defaults
61 to 65 and the
62 .Ar maximum
63 to 10 more than the
64 .Ar goal
65 length.
66 Alternatively, a single
67 .Ar width
68 parameter can be specified either by prepending a hyphen to it or by using
69 .Fl w .
70 For example,
71 .Dq Li fmt -w 72 ,
72 .Dq Li fmt -72 ,
73 and
74 .Dq Li fmt 72 72
75 all produce identical output.
76 The spacing at the beginning of the input lines is preserved in the output,
77 as are blank lines and interword spacing.
78 Lines are joined or split only at white space; that is, words are never
79 joined or hyphenated.
80 .Pp
81 The options are as follows:
82 .Bl -tag -width indent
83 .It Fl c
84 Center the text, line by line.
85 In this case, most of the other
86 options are ignored; no splitting or joining of lines is done.
87 .It Fl m
88 Try to format mail header lines contained in the input sensibly.
89 .It Fl n
90 Format lines beginning with a
91 .Ql \&.
92 (dot) character.
93 Normally,
94 .Nm
95 does not fill these lines, for compatibility with
96 .Xr nroff 1 .
97 .It Fl p
98 Allow indented paragraphs.
99 Without the
100 .Fl p
101 flag, any change in the amount of whitespace at the start of a line
102 results in a new paragraph being begun.
103 .It Fl s
104 Collapse whitespace inside lines, so that multiple whitespace
105 characters are turned into a single space.
106 (Or, at the end of a
107 sentence, a double space.)
108 .It Fl d Ar chars
109 Treat the
110 .Ar chars
111 (and no others) as sentence-ending characters.
112 By default the
113 sentence-ending characters are full stop
114 .Pq Ql \&. ,
115 question mark
116 .Pq Ql \&?
117 and exclamation mark
118 .Pq Ql \&! .
119 Remember that some characters may need to be
120 escaped to protect them from your shell.
121 .It Fl l Ar number
122 Replace multiple spaces with tabs at the start of each output
123 line, if possible.
124 Each
125 .Ar number
126 spaces will be replaced with one tab.
127 The default is 8.
128 If
129 .Ar number
130 is 0, spaces are preserved.
131 .It Fl t Ar number
132 Assume that the input files' tabs assume
133 .Ar number
134 spaces per tab stop.
135 The default is 8.
136 .El
137 .Pp
138 The
139 .Nm
140 utility
141 is meant to format mail messages prior to sending, but may also be useful
142 for other simple tasks.
143 For instance,
144 within visual mode of the
145 .Xr ex 1
146 editor (e.g.,
147 .Xr vi 1 )
148 the command
149 .Pp
150 .Dl \&!}fmt
151 .Pp
152 will reformat a paragraph,
153 evening the lines.
154 .Sh SEE ALSO
155 .Xr mail 1 ,
156 .Xr nroff 1
157 .Sh HISTORY
158 The
159 .Nm
160 command appeared in
161 .Bx 3 .
162 .Pp
163 The version described herein is a complete rewrite and appeared in
164 .Fx 4.4 .
165 .Sh AUTHORS
166 .An Kurt Shoens
167 .An Liz Allen
168 (added
169 .Ar goal
170 length concept)
171 .An Gareth McCaughan
172 .Sh BUGS
173 The program was designed to be simple and fast \- for more complex
174 operations, the standard text processors are likely to be more appropriate.
175 .Pp
176 When the first line of an indented paragraph is very long (more than
177 about twice the goal length), the indentation in the output can be
178 wrong.
179 .Pp
180 The
181 .Nm
182 utility is not infallible in guessing what lines are mail headers and what
183 lines are not.