home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
FM25.ZIP
/
README
< prev
Wrap
Text File
|
1993-04-12
|
5KB
|
81 lines
"Fm" formats text into paragraphs for tty screen display. It is similar to
UCB "fmt" and in fact can mimic that program, but it is somewhat more
flexible, and it does English hyphenation (the routines and data for hy-
phenation are taken from TeX). Even if you don't care for "fm", if you
write formatting utilities, you might be interested in the hyphenation
routine in file hyphenate.c.
Installation. You need flex to compile "fm". A stock unix compiler ought
to work, or gcc. Also, you need termcap to use the Makefile as sup-
plied. (See the note in the Makefile if you're on sys5r3.) As an alter-
native to using termcap, you can add "-DANSI" to CFLAGS, which substi-
tutes some built-in routines for color display on a suitable ANSI-type
console. If you don't actually have an ANSI color display device, you
won't be able to use the "-u" option of "fm".
Usage. "fm" is a filter. Send it input on standard input, or give on the
command line a list of files with text to process. The formatted result
appears on the standard output. There are a bunch of options, or the
program can be called by different names to vary the type of formatting
done. Screen attributes indicate different intended fonts, for files
with nroff -man or TeX formatting commands. See below and the files
fm.1, cmds.tex and the source code for details.
History & acknowledgments. The first version of this program was
written by Bill Gray (bgray@marque.mu.edu) and appeared in
comp.sources.misc, v02i102 (Apr. 1988) as "fmt". A second ver-
sion, called "xfmt" and modified by me was in comp.sources.unix,
v16i071 (Nov. 1988). My thanks to Ken Yap
(ken@cs.rochester.edu) and Dave Yearke, Sigma Systems Technol-
ogy, Inc. for fixes to some problems with that version.
Summary of modes. You can call "fm" by that name, or call it "fmt" or
"nroff" or "tex". Called by one of the first two names, it understands
no embedded formatting commands. Called "fmt" it emulates the UCB pro-
gram "fmt" and tries to preserve indentation and spacing from the origi-
nal input text. Called "nroff", it interprets -man page formatting com-
mands. Called "tex", it interprets a small subset of TeX commands.
Instead of giving it different names, instead you can use option flags
to the same effect: "fm -b" is the same as giving the program the name
"fmt" (b is for Berkeley); "fm -jmo" is the same as "nroff" (or "nroff
-man"); "fm -jx" is the same as "tex". With the name "tex", the suffix
.tex is added to a file name on the command name if a file by the name
given is not found.
Aside from embedded formatting commands, formatters differ in how to in-
terpret natural features of input text and what sort of formatting to do
by default. For instance, does blank space at the beginning of a line
start a new paragraph? Is the indentation carried over into the format-
ted output? The chart below outlines "fm"s four conventions about this.
fm fmt nroff tex
fm -b fm -jmo fm -jx
blank line starts par. yes yes yes yes
indent starts par. no* yes yes no*
keep paragraph indent no* yes no no*
add paragraph indent no no no yes(5)
keep word spacing no yes no no
keep blank lines yes yes yes no*
keep offset no yes no no
justification no no yes yes
hyphenation yes no yes yes
left offset no no yes(5) yes(4)
file suffix no no no yes(.tex)
Note: "no*" is "yes" with -i option.
What is it good for? (1) Making narrow columns for feeding to "pr"; e.g.,
"fm -40 -p2 textfile | pr -3 -w132 -l23 | more". (2) Displaying man
pages without a long wait or using disk space for preformatted versions;
e.g., "fm -jmo fm.1 | more" or (with program named "nroff") "nroff -man
fm.1 | more". (3) Format simple documents which may later be printed
using TeX; e.g., "fm -x README.tex >README" (which creates this file).
(4) Displaying C-code with reserved words highlighted; e.g., "fm -C fm.l
| more".
-- Greg Lee
lee@uhunix.uhcc.Hawaii.edu
5/5/92