[net.sources] clman.c and clman.1l

emigh@ecsvax.UUCP (09/27/83)

: Run this shell script with "sh" not "csh"
PATH=:/bin:/usr/bin:/usr/ucb
export PATH
all=FALSE
if [ $1x = -ax ]; then
	all=TRUE
fi
/bin/echo 'Extracting clman.1l'
sed 's/^X//' <<'//go.sysin dd *' >clman.1l
X.TH CLMAN 1
X.SH NAME
CLMAN -- Clean Up Man Output, Leaving No Backspaces in File

        CLMAN was written by Richard Conn
X.SH SYNOPSIS

        CLMAN accepts its input from STDIN and directs its output to
STDOUT.  It is intended to be used with the following forms:
X.nf

              man entry | clman >result    <-- output to file
              man entry | clman            <-- output to console

X.fi
        The resulting output contains no backspace characters and
is quite readable.
X.SH DESCRIPTION

        CLMAN removes some of the formatted output from MAN in order to
better display the result on a CRT (or non-backspacing device).  It
handles two cases:

            Boldface -- MAN generates <char> <backspace> <char>
when it wants to bold face; CLMAN removes the
<backspace> <char> part of the output

            Underline -- MAN generates '_' <backspace> <char> when
it wants to underline something; CLMAN removes
the '_' <backspace> part of the output

X.SH FILES
X.nf
clman.c    -- source code
X.fi
X.SH DIAGNOSTICS
        CLMAN generates no diagnostic error messages.
X.SH BUGS
        CLMAN contains no known bugs.  The exact form of all man output
is unknown to the author, however, and the cases of underline and boldface
are the only two accounted for by CLMAN.  It is possible that information
may be lost if backspaces are used in a sense other than that noted by
the author.  CLMAN has run successfully against a number of cases tested
so far, including 'man man', and no problems are known at this time.

X.SH AUTHOR
        CLMAN was written by Richard Conn.
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
	/bin/chmod 644 clman.1l
	/bin/echo -n '	'; /bin/ls -ld clman.1l
fi
/bin/echo 'Extracting clman.c'
sed 's/^X//' <<'//go.sysin dd *' >clman.c
X/*
 *  CLMAN -- Clean Up Man Output, Leaving No Backspaces in File
 *
 *	CLMAN was written by Richard Conn
 *
 *	CLMAN accepts its input from STDIN and directs its output to
 * STDOUT.  It is intended to be used with the following form:
 *		man entry | clman >result
 *	CLMAN removes some of the formatted output from MAN in order to
 * better display the result on a CRT (or non-backspacing device).  It
 * handles two cases:
 *		Boldface -- MAN generates <char> <backspace> <char>
 *			when it wants to bold face; CLMAN removes the
 *			<backspace> <char> part of the output
 *		Underline -- MAN generates '_' <backspace> <char> when
 *			it wants to underline something; CLMAN removes
 *			the '_' <backspace> part of the output
 *
 */

#include <stdio.h>

#define	BS	'\010'
#define	US	'_'

main(argc, argv)
int argc;
char *argv[];
{
	int c;

	while ((c = getchar()) != EOF)
		switch (c) {
		case US :
			c = getchar();
			if (c == BS) break;
			if (c == EOF) break;
			putchar(US);
			putchar(c);
			break;
		case BS :
			getchar();
			break;
		default :
			putchar(c);
			break;
		}
}
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
	/bin/chmod 644 clman.c
	/bin/echo -n '	'; /bin/ls -ld clman.c
fi