Idea for useful utility
utzoo!decvax!duke!mcnc!ncsu!msdc!dan
utzoo!decvax!duke!mcnc!ncsu!msdc!dan
Wed Apr 20 13:18:55 AEST 1983
We too had countless problems trying to remember how to run
an 'nroff' document. We (and our secretaries) have been using
a little shell program called 'runoff' for some time now.
By putting a special comment line at the beginning of an
'nroff' file, you can get it formatted by entering
runoff <document>
'Runoff' expects the first line of the first file named on
the command line to contain an nroff-style comment as follows:
.\" <command line to format the document>
The command can contain 'sh' variable substitutions, since it is
executed by the shell that executes 'runoff'. Most importantly,
"$1" is replaced by the first argument to 'runoff'.
Most of our things document files begin something like this:
.\" tbl $1 | nroff -mm | col
Dan Forsyth (decvax!duke!mcnc!msdc!dan)
Medical Systems Development Corp.
======================================
:
# runoff --- format and print a document using its first
# line as the command
if CMD=`head -1 $1`; then
:
else
exit
fi
if expr 0 = X"$CMD" : '^X\. *\\"' >/dev/null; then
echo 'First line of document must be .\\" <command>' 1>&2
exit 1
fi
NCMD=`echo "$CMD" | sed 's/^\. *\\\" *//'`
eval "$NCMD"
======================================
More information about the Comp.sources.unix
mailing list