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