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