Annotation of src/usr.bin/fmt/fmt.1, Revision 1.4
1.4 ! millert 1: .\" $OpenBSD$
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.4 ! millert 45: .Nm
! 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
53: .Oc
54: .Op name ...
55: .Sh DESCRIPTION
56: .Nm Fmt
57: is a simple text formatter which reads the concatenation of input
58: files (or standard input if none are given) and produces on standard
59: output a version of its input with lines as close to the
60: .Ar goal
61: length
1.4 ! millert 62: as possible without exceeding the
! 63: .Ar maximum.
! 64: The
1.1 deraadt 65: .Ar goal
66: length defaults
1.4 ! millert 67: to 65 and the
! 68: .Ar maximum
! 69: to 10 more than the goal length. The spacing at the beginning of the
1.1 deraadt 70: input lines is preserved in the output, as are blank lines and
71: interword spacing.
1.3 millert 72: .Pp
1.4 ! millert 73: The following options are available:
! 74: .Bl -tag -width indent
! 75: .It Fl c
! 76: Center the text, line by line. In this case, most of the other
! 77: options are ignored; no splitting or joining of lines is done.
! 78: .It Fl m
! 79: Try to format mail header lines contained in the input sensibly.
! 80: .It Fl p
! 81: Allow indented paragraphs. Without the
! 82: .Fl p
! 83: flag, any change in the amount of whitespace at the start of a line
! 84: results in a new paragraph being begun.
! 85: .It Fl s
! 86: Collapse whitespace inside lines, so that multiple whitespace
! 87: characters are turned into a single space. (Or, at the end of a
! 88: sentence, a double space.)
! 89: .It Fl d Ar chars
! 90: Treat the
! 91: .Ar chars
! 92: (and no others) as sentence-ending characters. By default the
! 93: sentence-ending characters are full stop, question mark and
! 94: exclamation mark. Remember that some characters may need to be
! 95: escaped to protect them from your shell.
! 96: .It Fl l Ar number
! 97: Replace multiple spaces with tabs at the start of each output
! 98: line, if possible.
! 99: .Ar number
! 100: spaces will be replaced with one tab.
! 101: .It Fl t Ar number
! 102: Assume that the input files' tabs assume
! 103: .Ar number
! 104: spaces per tab stop. The default is 8.
! 105: .El
1.1 deraadt 106: .Pp
107: .Nm Fmt
108: is meant to format mail messages prior to sending, but may also be useful
109: for other simple tasks.
110: For instance,
111: within visual mode of the
112: .Xr ex 1
113: editor (e.g.
114: .Xr vi 1 )
115: the command
116: .Pp
117: .Dl \&!}fmt
118: .Pp
119: will reformat a paragraph,
120: evening the lines.
121: .Sh SEE ALSO
1.4 ! millert 122: .Xr mail 1 ,
! 123: .Xr nroff 1
1.1 deraadt 124: .Sh HISTORY
1.4 ! millert 125: An
! 126: .Nm
1.1 deraadt 127: command appeared in
128: .Bx 3 .
1.4 ! millert 129: .Pp
! 130: The version described herein is a complete rewrite and appeared in
! 131: .\" .Ox 2.4 .
! 132: .Bx Open
! 133: 2.4.
1.1 deraadt 134: .\" .Sh AUTHOR
135: .\" Kurt Shoens
136: .\" .br
137: .\" Liz Allen (added goal length concept)
1.4 ! millert 138: .\" The above are the authors of the old `fmt' program;
! 139: .\" the present one was written by Gareth McCaughan.
1.1 deraadt 140: .Sh BUGS
141: The program was designed to be simple and fast \- for more complex
142: operations, the standard text processors are likely to be more appropriate.
1.4 ! millert 143: .Pp
! 144: When the first line of an indented paragraph is very long (more than
! 145: about twice the goal length), the indentation in the output can be
! 146: wrong.
! 147: .Pp
! 148: .Nm
! 149: is not infallible in guessing what lines are mail headers and what
! 150: lines are not.