[net.sources] roff - smart nroff/troff script

garyp@cognos.UUCP (Gary Puckering) (01/21/87)

--
There seems to be a lot of interest lately in scripts and aliases to
make life with nroff, troff, ditroff, eqn, tbl, etc. more bearable.
Here at Cognos, we use "ptroff" from Adobe for typesetting.  Like
everybody else, trying to remember the proper sequence of commands to
format a document is a problem for us too!

So, here's my contribution to a solution.  It's called "roff" (original,
eh!) and it has some nice features.  For one, it can figure out which
macro package to use based on the file name.  And, the rules can easily 
be changed to accomodate your own naming conventions.

Another feature of roff is that it provides the correct pre- and
post-processing by tbl, eqn, col or colcrt when necessary.  Again, this
is mostly based on file naming conventions.  When printed output is
requested, ptroff is used instead of nroff and eqn is used instead of
neqn.  When terminal output is requested, the output is delivered to
"more", or to the pager specified in the environment variable $PAGER.
Post-processing by "colcrt" is done first if pre-processing by tbl or
eqn was performed.

Installation should be pretty straightforward.  I've even included a
makefile.  Since we have our own macro package called "mcognos" (an
extension to "ms") you will probably want to edit the script file and
the man page to change "mcognos" to your favorite local macro package.
("mcognos" is used whenever roff can't decide on something else.)
You might also want to modify the filename patterns if you follow a
different naming convention than we do.

One word of caution:  some of the string literals in the roff script
have leading or trailing spaces.  DON'T REMOVE THEM.  They are necessary
for the variable "cmd" to be expanded properly.

---------------------- cut here -----------------------------------
#!/bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #!/bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	roff.l
#	roff
#	Makefile
# This archive created: Wed Jan 21 08:45:34 1987
export PATH; PATH=/bin:$PATH
echo shar: extracting "'roff.l'" '(4542 characters)'
if test -f 'roff.l'
then
	echo shar: over-writing existing file "'roff.l'"
fi
sed 's/^X//' << \SHAR_EOF > 'roff.l'
X.\" @(#)roff.l 2.0 87/01/20 COGNOS Inc.; 
X.TH ROFF 1L "20 January 1987" "Cognos Inc."
X.SH NAME
Xroff \- nroff/troff to printer or terminal with eqn or tbl
X.SH SYNOPSIS
X.IP \fBroff\fR 5
X[\^\fB-d\fR\^]
X[\^\fB-p\fR\^] 
X[\^\fB-eqn\fR\^]
X[\^\fB-tbl\fR\^] 
X[\^\fB-m\fImacro\fR\^]
X.br
X[\^\fB-col\fR\^] 
X[\^\fB-colcrt\fR\^]
X[\^\fB-mail\fR\^]
X[\^\fB-test\fR\^] 
X.br
X[\^\fIoptions\fR\^]
X\fIfile\fR ...
X.SH DESCRIPTION
X.IX  "roff command"  ""  "\fLroff\fP \(em nroff using -mcognos"
X.IX  "document production"  "roff command" 
X.IX  "nroff" "macros" "-mcognos"
XThe \fBroff\fR command
Xis used to format documents with \fBnroff\fR or \fBptroff\fR and to
Xsimplify the task of applying pre-processors (like \fBtbl\fR and 
X\fBeqn\fR) to the input and post-processors (like \fBcolcrt\fR and 
X\fBmore\fR) to the output.
X.LP
XInput is pre-processed by \fBtbl\fR or \fBeqn\fR if the \fB-tbl\fR or
X\fB-eqn\fR options are specified, or if the file name contains ".tbl" or
X".eqn".
X.LP
XIf the input is pre-processed, then the output is, by default, filtered
Xthrough the post-processor \fBcolcrt\fR or through \fBcol\fR to remove
Xany vertical motions that would appear as non-printing characters at
Xthe terminal.  The filtered output is then passed to \fBmore\fR, or to
Xthe command specified by the environment variable $PAGER.
X.LP
XNormally, the formatter \fBnroff\fR is used.  When the \fB-p\fR option
Xis specified the formatter \fBproff\fR is used instead.  Output is then
Xtypeset and sent to the laser printer.  No post-processing is performed
Xin this case.
X.LP
XText can be piped to \fBroff\fR by using "-" as the filename,
Xas in the command "cat\ junk\ |\ roff\ -".
X.SH OPTIONS
X.IP \fB-col\fR
XForces the output from \fBnroff\fR or \fBptroff\fR to be filtered
Xthrough \fBcol\fR before being piped to $PAGER.  This eliminates most
Xvertical motions that would show up as control sequences in the output,
Xexcept for linefeed suppression, which can be handled by most line printers. 
XUseful when piping \fBnroff\fR output to a regular printer.
X.IP \fB-colcrt\fR
XForces the output from \fBnroff\fR or \fBptroff\fR to be filtered
Xthrough \fBcolcrt\fR before being piped to $PAGER.  This eliminates all
Xvertical motions that would show up as control sequences in the output,
Xmaking it suitable for display at the terminal.
X.IP \fB-d\fR
XOutput to disk.  When this option is selected, the formatter \fBnroff\fR
Xis used and if pre-processing is done, then
Xthe output is filtered through \fBcol\fR
X.ul 1
Xwithout
Xbeing passed to $PAGER afterwards.  This option is suitable for saving
Xthe formatted output in a file or for piping it directly to \fBlpr\fR.
X.IP \fB-eqn\fR
XForces the input files to be pre-processed by \fBeqn\fR before being
Xpiped to \fBnroff\fR or \fBptroff\fR.
X.IP \fB-mail\fR
XSpecifies to \fBptroff\fR that the user is to be notified by mail when
Xprinting has completed.  The actual \fBptroff\fR option is \fB-m\fR, but
Xthis is overridden by \fBroff\fR's own \fB-m\fR option (see below).
X.IP \fB-m\fImacro\fR
XSpecifies the macro package to be used by \fBnroff\fR of \fBptroff\fR.
XIf \fB-m\fR is specified, no macro package is used.
XIf omitted altogether, the \fI-mcognos\fR package is used, 
Xexcept when the filename matches one of the following patterns:
X.sp
X.ta +5n +15n
X.nf
X.ul 1
X	Pattern	Macro Package
X	*.[1-9]	-man
X	*.l	-man
X	*.man	-man
X	*.nms	-ms
X	*.nme	-me
X	*.nroff	(none)
X.ta	
X.fi
X.IP \fB-p\fR
XCauses output to be sent to the printer.  The formatter \fBptroff\fR is
Xused, rather than \fBnroff\fR, and all post-processing is ignored (i.e.
X\fBcol\fR, \fBcolcrt\fR, or $PAGER).
X.IP \fB-tbl\fR
XForces the input files to be pre-processed by \fBtbl\fR before being
Xpiped to \fBnroff\fR or \fBptroff\fR.
X.IP \fB-test\fR
XEnables test mode.  In this mode, \fBroff\fR will form the command and
Xecho it to the terminal, but not execute it.
X.IP \fIoptions\fR
XAny of the options available in \fBnroff\fR or, when \fB-p\fR is
Xspecified, in \fBptroff\fR and \fBtroff\fR.
X.SH FILES
X.ta \w'/usr/man/manl/roff.l\0\0'u
X.nf
X/usr/local/bin/roff	shell
X/usr/man/manl/roff.l	this document
X.fi
X.SH SEE ALSO
Xmcognos(l), nroff(1), troff(1), ptroff(1), eqn(1), tbl(1), 
Xcol(1), colcrt(1), more(1), lpr(1)
X.br
X.I "Formatting Documents on the Sun Workstation"
X.SH BUGS
X.IP 1. 4n
XWhen roffing a table to the terminal, \fBcolcrt\fR is used to filter out
Xhalf-line motions.  Unfortunately, it also replaces true underlines (in
Xthe non-table portions of the text) with a separate line of dashes.
X.LP
XPlease report any other bugs to Gary Puckering, COGNOS Inc. 
X.br
X(E-mail garyp@cognos).
SHAR_EOF
if test 4542 -ne "`wc -c 'roff.l'`"
then
	echo shar: error transmitting "'roff.l'" '(should have been 4542 characters)'
fi
echo shar: extracting "'roff'" '(2346 characters)'
if test -f 'roff'
then
	echo shar: over-writing existing file "'roff'"
fi
sed 's/^X//' << \SHAR_EOF > 'roff'
X#!/bin/sh
X#
X# Shell to nroff files to printer or terminal
X# Written by Gary Puckering, COGNOS Inc.
X# January 20, 1987
X
Xoutput="terminal"
XROFF="nroff"
XEQN="neqn"
XCOL="colcrt"
Xmacro="-mcognos"
X
Xeqn=
Xtbl=
Xcol=
Xmacro=
Xtest=
Xinfile=
Xnflags=
X
Xif test "$PAGER" 
Xthen pager="| $PAGER "
Xelse pager="| more "
Xfi
X
X
Xdofile() {
X
X# reset flags
X  eqnFile="$eqn"
X  tblFile="$tbl"
X  colFile="$col"
X  macroFile="$macro "
X
X  case $infile in
X	*.tbl*)
X		tblFile="yes"
X		colFile="yes"
X		;;
X	*.eqn*)
X		eqnFile="yes"
X		colFile="yes"
X		;;
X	*.eqn.tbl*)
X		eqnFile="yes"
X		tblFile="yes"
X		colFile="yes"
X		;;
X	*.let)
X		colFile="yes" ;;
X	*.[1-9l])
X		macroFile="-man " ;;
X	*.man)
X		macroFile="-man " ;;
X	*.nms)
X		macroFile="-ms " ;;
X	*.nme)
X		macroFile="-me " ;;
X	*.nroff)
X		macroFIle="" ;;
X	esac
X
X  file=""
X
X# Insert the file name into the first command (tbl, eqn, or *nroff)
X  if test "$tblFile" = ""
X  then if test "$eqnFile" = ""
X         then file="$infile "
X         else eqnFile="$EQN $infile | "
X	 fi
X  else 
X	 tblFile="tbl $infile | "
X	 if test "$eqnFile"
X	 then eqnFile="$EQN | "
X	 fi
X  fi
X
X  if test "$colFile"
X  then colFile="| $COL "
X  fi
X
X# When ptroff is requested, no post-processing is allowed.
X  if test "$ROFF" = "ptroff"
X  then 
X	colFile=
X	pager=
X  fi
X
X  if test "$output" != "terminal"
X  then pager=""
X  fi
X
X  cmd="$tblFile$eqnFile$ROFF $macroFile$nflags$file$colFile$pager" 
X
X  if test -t		# if output to terminal
X  then echo "	$cmd"
X  fi
X
X# In test mode, don't evaluate the command
X  if test "$test" 
X  then 
X	return
X  else
X	eval $cmd
X  fi
X}
X
Xfor i in $* 
Xdo case $i in
X	-test)
X		test="yes" 
X		if test -t	# if output to terminal
X		then echo "	*** Test Mode ***"
X		fi ;;
X	-m)
X		macro="" ;;
X	-mail)
X		nflags="$nflags -m " ;;
X	-m*)
X		macro="$i" ;;
X	-d)
X		output="disk"
X		if test -t
X		then echo "	=== Roff to disk (stdout) ==="
X		fi
X		EQN="neqn"
X		COL="col" 
X		ROFF="nroff"
X		;;
X	-p)
X		output="printer"
X		if test -t
X		then echo "	=== Roff to printer ==="
X		fi
X		EQN="eqn"
X		COL="col"
X		ROFF="ptroff" 
X		;;
X	-tbl)
X		tbl="yes"
X		col="yes" ;;
X	-eqn)
X		eqn="yes" 
X		col="yes" ;;
X	-colcrt)
X		COL="colcrt"
X		col="yes" ;;
X	-col)
X		COL="col"
X		col="yes" ;;
X	-?*)
X		nflags="$nflags $i " ;;
X	-)
X		infile=""
X		dofile ;;
X	[!-]*)
X		infile="$i"
X		if test -r "$infile"
X		then dofile
X		else echo roff: filename "$i" is invalid or unreadable >&2
X		fi 
X		;;
X  esac
Xdone
X
Xexit
SHAR_EOF
if test 2346 -ne "`wc -c 'roff'`"
then
	echo shar: error transmitting "'roff'" '(should have been 2346 characters)'
fi
echo shar: extracting "'Makefile'" '(837 characters)'
if test -f 'Makefile'
then
	echo shar: over-writing existing file "'Makefile'"
fi
sed 's/^X//' << \SHAR_EOF > 'Makefile'
X# Makefile for roff
X# Gary Puckering, Cognos Inc.   December 8, 1986
X# 
X# This makefile is intended for the sys5 Augmented make.
X# 
XMAKE=make 
XCLEAN=clean
X# R is the root of the filesystem -- i.e. where to install things.
X# The binaries are installed in $R/$(DESTDIR).
XR=/usr
XDESTDIR=$R/local/bin
XMANDIR=$R/man/manl
XPROG=roff
X
X# PROG is what to make; DESTDIR is where to put it.
X
X# R is intended to be the root of the filesystem if it isn't "/"
X
X# "make install " does a $(MAKE) $(CLEAN) at the end, so you can say
X# CLEAN=  make -e install
X# if you don't want to remove the garbage at the end, for example.
X# This is useful primarily for testing the install: entry!
X
Xinstall: 
X	/bin/chmod a+r,u+w $(PROG) $(PROG).l
X	/bin/chmod a+x $(PROG)
X	/bin/cp $(PROG) $(DESTDIR)
X	/bin/cp $(PROG).l $(MANDIR)
X	$(MAKE) $(CLEAN)
X 
Xclean: 
X	sccs clean
SHAR_EOF
if test 837 -ne "`wc -c 'Makefile'`"
then
	echo shar: error transmitting "'Makefile'" '(should have been 837 characters)'
fi
#	End of shell archive
exit 0
-- 
Gary Puckering        3755 Riverside Dr.
Cognos Incorporated   Ottawa, Ontario
(613) 738-1440        CANADA  K1G 3N3

garyp@cognos.UUCP (Gary Puckering) (01/21/87)

--
There seems to be a lot of interest lately in scripts and aliases to
make life with nroff, troff, ditroff, eqn, tbl, etc. more bearable.
Here at Cognos, we use "ptroff" from Adobe for typesetting.  Like
everybody else, trying to remember the proper sequence of commands to
format a document is a problem for us too!

So, here's my contribution to a solution.  It's called "roff" (original,
eh!) and it has some nice features.  For one, it can figure out which
macro package to use based on the file name.  And, the rules can easily 
be changed to accomodate your own naming conventions.

Another feature of roff is that it provides the correct pre- and
post-processing by tbl, eqn, col or colcrt when necessary.  Again, this
is mostly based on file naming conventions.  When printed output is
requested, ptroff is used instead of nroff and eqn is used instead of
neqn.  When terminal output is requested, the output is delivered to
"more", or to the pager specified in the environment variable $PAGER.
Post-processing by "colcrt" is done first if pre-processing by tbl or
eqn was performed.

Installation should be pretty straightforward.  I've even included a
makefile.  Since we have our own macro package called "mcognos" (an
extension to "ms") you will probably want to edit the script file and
the man page to change "mcognos" to your favorite local macro package.
("mcognos" is used whenever roff can't decide on something else.)
You might also want to modify the filename patterns if you follow a
different naming convention than we do.

One word of caution:  some of the string literals in the roff script
have leading or trailing spaces.  DON'T REMOVE THEM.  They are necessary
for the variable "cmd" to be expanded properly.

---------------------- cut here -----------------------------------
#!/bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #!/bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	roff.l
#	roff
#	Makefile
# This archive created: Wed Jan 21 09:52:21 1987
export PATH; PATH=/bin:$PATH
echo shar: extracting "'roff.l'" '(4542 characters)'
if test -f 'roff.l'
then
	echo shar: over-writing existing file "'roff.l'"
fi
sed 's/^X//' << \SHAR_EOF > 'roff.l'
X.\" @(#)roff.l 2.0 87/01/20 COGNOS Inc.; 
X.TH ROFF 1L "20 January 1987" "Cognos Inc."
X.SH NAME
Xroff \- nroff/troff to printer or terminal with eqn or tbl
X.SH SYNOPSIS
X.IP \fBroff\fR 5
X[\^\fB-d\fR\^]
X[\^\fB-p\fR\^] 
X[\^\fB-eqn\fR\^]
X[\^\fB-tbl\fR\^] 
X[\^\fB-m\fImacro\fR\^]
X.br
X[\^\fB-col\fR\^] 
X[\^\fB-colcrt\fR\^]
X[\^\fB-mail\fR\^]
X[\^\fB-test\fR\^] 
X.br
X[\^\fIoptions\fR\^]
X\fIfile\fR ...
X.SH DESCRIPTION
X.IX  "roff command"  ""  "\fLroff\fP \(em nroff using -mcognos"
X.IX  "document production"  "roff command" 
X.IX  "nroff" "macros" "-mcognos"
XThe \fBroff\fR command
Xis used to format documents with \fBnroff\fR or \fBptroff\fR and to
Xsimplify the task of applying pre-processors (like \fBtbl\fR and 
X\fBeqn\fR) to the input and post-processors (like \fBcolcrt\fR and 
X\fBmore\fR) to the output.
X.LP
XInput is pre-processed by \fBtbl\fR or \fBeqn\fR if the \fB-tbl\fR or
X\fB-eqn\fR options are specified, or if the file name contains ".tbl" or
X".eqn".
X.LP
XIf the input is pre-processed, then the output is, by default, filtered
Xthrough the post-processor \fBcolcrt\fR or through \fBcol\fR to remove
Xany vertical motions that would appear as non-printing characters at
Xthe terminal.  The filtered output is then passed to \fBmore\fR, or to
Xthe command specified by the environment variable $PAGER.
X.LP
XNormally, the formatter \fBnroff\fR is used.  When the \fB-p\fR option
Xis specified the formatter \fBproff\fR is used instead.  Output is then
Xtypeset and sent to the laser printer.  No post-processing is performed
Xin this case.
X.LP
XText can be piped to \fBroff\fR by using "-" as the filename,
Xas in the command "cat\ junk\ |\ roff\ -".
X.SH OPTIONS
X.IP \fB-col\fR
XForces the output from \fBnroff\fR or \fBptroff\fR to be filtered
Xthrough \fBcol\fR before being piped to $PAGER.  This eliminates most
Xvertical motions that would show up as control sequences in the output,
Xexcept for linefeed suppression, which can be handled by most line printers. 
XUseful when piping \fBnroff\fR output to a regular printer.
X.IP \fB-colcrt\fR
XForces the output from \fBnroff\fR or \fBptroff\fR to be filtered
Xthrough \fBcolcrt\fR before being piped to $PAGER.  This eliminates all
Xvertical motions that would show up as control sequences in the output,
Xmaking it suitable for display at the terminal.
X.IP \fB-d\fR
XOutput to disk.  When this option is selected, the formatter \fBnroff\fR
Xis used and if pre-processing is done, then
Xthe output is filtered through \fBcol\fR
X.ul 1
Xwithout
Xbeing passed to $PAGER afterwards.  This option is suitable for saving
Xthe formatted output in a file or for piping it directly to \fBlpr\fR.
X.IP \fB-eqn\fR
XForces the input files to be pre-processed by \fBeqn\fR before being
Xpiped to \fBnroff\fR or \fBptroff\fR.
X.IP \fB-mail\fR
XSpecifies to \fBptroff\fR that the user is to be notified by mail when
Xprinting has completed.  The actual \fBptroff\fR option is \fB-m\fR, but
Xthis is overridden by \fBroff\fR's own \fB-m\fR option (see below).
X.IP \fB-m\fImacro\fR
XSpecifies the macro package to be used by \fBnroff\fR of \fBptroff\fR.
XIf \fB-m\fR is specified, no macro package is used.
XIf omitted altogether, the \fI-mcognos\fR package is used, 
Xexcept when the filename matches one of the following patterns:
X.sp
X.ta +5n +15n
X.nf
X.ul 1
X	Pattern	Macro Package
X	*.[1-9]	-man
X	*.l	-man
X	*.man	-man
X	*.nms	-ms
X	*.nme	-me
X	*.nroff	(none)
X.ta	
X.fi
X.IP \fB-p\fR
XCauses output to be sent to the printer.  The formatter \fBptroff\fR is
Xused, rather than \fBnroff\fR, and all post-processing is ignored (i.e.
X\fBcol\fR, \fBcolcrt\fR, or $PAGER).
X.IP \fB-tbl\fR
XForces the input files to be pre-processed by \fBtbl\fR before being
Xpiped to \fBnroff\fR or \fBptroff\fR.
X.IP \fB-test\fR
XEnables test mode.  In this mode, \fBroff\fR will form the command and
Xecho it to the terminal, but not execute it.
X.IP \fIoptions\fR
XAny of the options available in \fBnroff\fR or, when \fB-p\fR is
Xspecified, in \fBptroff\fR and \fBtroff\fR.
X.SH FILES
X.ta \w'/usr/man/manl/roff.l\0\0'u
X.nf
X/usr/local/bin/roff	shell
X/usr/man/manl/roff.l	this document
X.fi
X.SH SEE ALSO
Xmcognos(l), nroff(1), troff(1), ptroff(1), eqn(1), tbl(1), 
Xcol(1), colcrt(1), more(1), lpr(1)
X.br
X.I "Formatting Documents on the Sun Workstation"
X.SH BUGS
X.IP 1. 4n
XWhen roffing a table to the terminal, \fBcolcrt\fR is used to filter out
Xhalf-line motions.  Unfortunately, it also replaces true underlines (in
Xthe non-table portions of the text) with a separate line of dashes.
X.LP
XPlease report any other bugs to Gary Puckering, COGNOS Inc. 
X.br
X(E-mail garyp@cognos).
SHAR_EOF
if test 4542 -ne "`wc -c 'roff.l'`"
then
	echo shar: error transmitting "'roff.l'" '(should have been 4542 characters)'
fi
echo shar: extracting "'roff'" '(2351 characters)'
if test -f 'roff'
then
	echo shar: over-writing existing file "'roff'"
fi
sed 's/^X//' << \SHAR_EOF > 'roff'
X#!/bin/sh
X#
X# Shell to nroff files to printer or terminal
X# Written by Gary Puckering, COGNOS Inc.
X# January 20, 1987
X
Xoutput="terminal"
XROFF="nroff"
XEQN="neqn"
XCOL="colcrt"
Xmacro="-mcognos"
X
Xeqn=""
Xtbl=""
Xcol=""
Xtest=""
Xinfile=""
Xnflags=""
X
Xif test "$PAGER" 
Xthen pager="| $PAGER "
Xelse pager="| more "
Xfi
X
X
Xdofile() {
X
X# reset flags
X  eqnFile="$eqn"
X  tblFile="$tbl"
X  colFile="$col"
X  macroFile="$macro "
X
X  case $infile in
X	*.tbl*)
X		tblFile="yes"
X		colFile="yes"
X		;;
X	*.eqn*)
X		eqnFile="yes"
X		colFile="yes"
X		;;
X	*.eqn.tbl*)
X		eqnFile="yes"
X		tblFile="yes"
X		colFile="yes"
X		;;
X	*.let)
X		colFile="yes" ;;
X	*.[1-9l])
X		macroFile="-man " ;;
X	*.man)
X		macroFile="-man " ;;
X	*.nms)
X		macroFile="-ms " ;;
X	*.nme)
X		macroFile="-me " ;;
X	*.nroff)
X		macroFIle="" ;;
X	esac
X
X  file=""
X
X# Insert the file name into the first command (tbl, eqn, or *nroff)
X  if test "$tblFile" = ""
X  then if test "$eqnFile" = ""
X         then file="$infile "
X         else eqnFile="$EQN $infile | "
X	 fi
X  else 
X	 tblFile="tbl $infile | "
X	 if test "$eqnFile"
X	 then eqnFile="$EQN | "
X	 fi
X  fi
X
X  if test "$colFile"
X  then colFile="| $COL "
X  fi
X
X# When ptroff is requested, no post-processing is allowed.
X  if test "$ROFF" = "ptroff"
X  then 
X	colFile=
X	pager=
X  fi
X
X  if test "$output" != "terminal"
X  then pager=""
X  fi
X
X  cmd="$tblFile$eqnFile$ROFF $macroFile$nflags$file$colFile$pager" 
X
X  if test -t		# if output to terminal
X  then echo "	$cmd"
X  fi
X
X# In test mode, don't evaluate the command
X  if test "$test" 
X  then 
X	return
X  else
X	eval $cmd
X  fi
X}
X
Xfor i in $* 
Xdo case $i in
X	-test)
X		test="yes" 
X		if test -t	# if output to terminal
X		then echo "	*** Test Mode ***"
X		fi ;;
X	-m)
X		macro="" ;;
X	-mail)
X		nflags="$nflags -m " ;;
X	-m*)
X		macro="$i" ;;
X	-d)
X		output="disk"
X		if test -t
X		then echo "	=== Roff to disk (stdout) ==="
X		fi
X		EQN="neqn"
X		COL="col" 
X		ROFF="nroff"
X		;;
X	-p)
X		output="printer"
X		if test -t
X		then echo "	=== Roff to printer ==="
X		fi
X		EQN="eqn"
X		COL="col"
X		ROFF="ptroff" 
X		;;
X	-tbl)
X		tbl="yes"
X		col="yes" ;;
X	-eqn)
X		eqn="yes" 
X		col="yes" ;;
X	-colcrt)
X		COL="colcrt"
X		col="yes" ;;
X	-col)
X		COL="col"
X		col="yes" ;;
X	-?*)
X		nflags="$nflags $i " ;;
X	-)
X		infile=""
X		dofile ;;
X	[!-]*)
X		infile="$i"
X		if test -r "$infile"
X		then dofile
X		else echo roff: filename "$i" is invalid or unreadable >&2
X		fi 
X		;;
X  esac
Xdone
X
Xexit
SHAR_EOF
if test 2351 -ne "`wc -c 'roff'`"
then
	echo shar: error transmitting "'roff'" '(should have been 2351 characters)'
fi
echo shar: extracting "'Makefile'" '(837 characters)'
if test -f 'Makefile'
then
	echo shar: over-writing existing file "'Makefile'"
fi
sed 's/^X//' << \SHAR_EOF > 'Makefile'
X# Makefile for roff
X# Gary Puckering, Cognos Inc.   December 8, 1986
X# 
X# This makefile is intended for the sys5 Augmented make.
X# 
XMAKE=make 
XCLEAN=clean
X# R is the root of the filesystem -- i.e. where to install things.
X# The binaries are installed in $R/$(DESTDIR).
XR=/usr
XDESTDIR=$R/local/bin
XMANDIR=$R/man/manl
XPROG=roff
X
X# PROG is what to make; DESTDIR is where to put it.
X
X# R is intended to be the root of the filesystem if it isn't "/"
X
X# "make install " does a $(MAKE) $(CLEAN) at the end, so you can say
X# CLEAN=  make -e install
X# if you don't want to remove the garbage at the end, for example.
X# This is useful primarily for testing the install: entry!
X
Xinstall: 
X	/bin/chmod a+r,u+w $(PROG) $(PROG).l
X	/bin/chmod a+x $(PROG)
X	/bin/cp $(PROG) $(DESTDIR)
X	/bin/cp $(PROG).l $(MANDIR)
X	$(MAKE) $(CLEAN)
X 
Xclean: 
X	sccs clean
SHAR_EOF
if test 837 -ne "`wc -c 'Makefile'`"
then
	echo shar: error transmitting "'Makefile'" '(should have been 837 characters)'
fi
#	End of shell archive
exit 0
-- 
Gary Puckering        3755 Riverside Dr.
Cognos Incorporated   Ottawa, Ontario
(613) 738-1440        CANADA  K1G 3N3