[net.sources] Fast man command for System 5

tracy@hcrvx1.UUCP (Tracy Tims) (02/04/85)

This is a program I wrote before we got our System 5.2 manuals printed
so that I could access the online manual pages in under 2 minutes.  It
is intentionally not very smart.  It is quite fast.  It requires the
presence of libndir and you should modify the Makefile to reflect your
site organization.

There is no 4.nBSD support as they already have "fast" man commands.

                              Tracy Tims    {linus,allegra,decvax}!watmath!...
   Human Computing Resources Corporation                     {ihnp4,utzoo}!...
 Toronto, Ontario, Canada.  416 922-1937                   ...hcr!hcrvx1!tracy

#  ---------- Remove everything preceeding this line ---------
#  This is a shell archive.  To unpack it:
#  1.  Remove everything above the first line.
#  2.  Feed this file into a Bourne shell using '$ sh < file'
#	Makefile
#	READ_ME
#	defs.h
#	err.c
#	fman.man
#	globals.c
#	main.c
#	msg.c
#	output.c
#	output.h
#	search.c
#	table.c
#	table.h
#	tools.h
#  This archive created: Sun Feb  3 23:34:33 1985
#  By:	Tracy Tims (Human Computing Resources Corp)
PATH=/bin:/usr/bin; export PATH
echo shar: extracting "'Makefile'" '(1018 characters)'
if test -f 'Makefile'
then
	echo shar: over-writing existing file "'Makefile'"
fi
sed 's/^x//' << \SHAR_EOF > 'Makefile'
x#	Makefile for fman
x#
x#	Tracy Tims
x#	18 Oct 84
x#
x#	This makefile should be executed with HOME set in the make invocation
x#	line.
x#
x#	This makefile keeps the binary and documentation as links
x#	between the source and installed directories.  If the local
x#	version is to be remade, the makefile breaks the links first.
x#	An install reforges them.
x
xI	= $(HOME)/include
xL	= $(HOME)/lib
xM	= $(HOME)/man/cat1
xB	= $(HOME)/cmd
x
xPROF	=
xLIBS	= $L/ndir.a
xINCLUDE = -I.
xCFLAGS	= $(PROF) -O $(INCLUDE)
xLFLAGS	= $(PROF)
x
xSOURCES = main.c search.c table.c err.c msg.c globals.c output.c
xOBJS	= main.o search.o table.o err.o msg.o globals.o output.o
x
xall:		local
xlocal:		fman fman.doc
xinstall:	$B/fman $M/fman.doc
x
xfman:	$(OBJS)
x	-rm fman
x	$(CC) $(LFLAGS) $(DEBUG) -o fman $(OBJS) $(LIBS)
x
xfman.doc:	fman.man
x	-rm fman.doc
x	nroff -man fman.man > fman.doc
x
x$B/fman:	fman
x	cp fman $B/fman
x	rm fman
x	ln $B/fman fman
x
x$M/fman.doc:	fman.doc
x	-rm $M/fman.doc
x	ln fman.doc $M/fman.doc
x
xclean:
x	-rm $(OBJS)
x
xlint:
x	lint $(INCLUDE) $(SOURCES)
SHAR_EOF
if test 1018 -ne "`wc -c 'Makefile'`"
then
	echo shar: error transmitting "'Makefile'" '(should have been 1018 characters)'
fi
chmod +x 'Makefile'
echo shar: extracting "'READ_ME'" '(564 characters)'
if test -f 'READ_ME'
then
	echo shar: over-writing existing file "'READ_ME'"
fi
sed 's/^x//' << \SHAR_EOF > 'READ_ME'
xFast Manual Command for System 5
x
xThe files table.h and table.c define the searched directories.  The files
xoutput.h and output.c define the commands available for printing the manual
xpages.
x
xThis program was originally written with references to my personal tools
xlibrary.  I have simply included the relevant parts.
x
xPLEASE NOTE:  This program is not designed to be smart.  It is designed to
xbe fast so that people can get at man pages even on a loaded system.
x
xThis program requires the Berkeley directory interface routines.  Everyone
xshould have them by now.
SHAR_EOF
if test 564 -ne "`wc -c 'READ_ME'`"
then
	echo shar: error transmitting "'READ_ME'" '(should have been 564 characters)'
fi
echo shar: extracting "'defs.h'" '(784 characters)'
if test -f 'defs.h'
then
	echo shar: over-writing existing file "'defs.h'"
fi
sed 's/^x//' << \SHAR_EOF > 'defs.h'
x/*
x *	fman
x *
x *	defs.h - configuration definitions
x *
x *	Author
x *
x *		18 Oct 84	tracy@hcr		Tracy Tims
x *
x *	Changes
x *
x *		dd mmm yy	user@site		real name
x *				description
x */
x
x#define PATHSIZE	256
x#define COMSIZE		512
x
x#define streq(a,b)	(!strcmp(a,b))
x
x/*
x *	O u t p u t   p a r a m e t e r s.
x */
x
x#define P_CAT		"/bin/cat"		/* location of cat	*/
x#define N_CAT		"cat"			/* argv[0] of cat	*/
x
x#define P_PCAT		"/usr/bin/pcat"		/* location of pcat	*/
x#define N_PCAT		"pcat"			/* argv[0] of pcat	*/
x
x#define P_NROFF		"/usr/bin/nroff"	/* location of nroff	*/
x#define N_NROFF		"nroff"			/* argv[0] of nroff	*/
x#define M_NROFF		"-man"			/* macros for nroff	*/
x
x/*
x *	S e a r c h   F u n c t i o n s.
x */
x
x#define F_PATH		0			/* print path		*/
x#define F_FUNC		1			/* execute function	*/
SHAR_EOF
if test 784 -ne "`wc -c 'defs.h'`"
then
	echo shar: error transmitting "'defs.h'" '(should have been 784 characters)'
fi
echo shar: extracting "'err.c'" '(530 characters)'
if test -f 'err.c'
then
	echo shar: over-writing existing file "'err.c'"
fi
sed 's/^x//' << \SHAR_EOF > 'err.c'
x/*
x *	tools
x *
x *	err - error function
x *
x *	Author
x *
x *		27 Aug 84	tracy@hcr		Tracy Tims
x *
x *	Changes
x *
x *		dd mmm yy	user@site		real name
x *				description
x *		12 Oct 84	tracy@hcr		Tracy Tims
x *				New versions of error functions.
x */
x
x#include <stdio.h>
x#include <varargs.h>
x#include "tools.h"
x
xextern int		_doprnt();
x
x/*VARARGS2*/
xerr( fmt, va_alist)
x	char		*fmt;
x	va_dcl
x{
x	va_list		args;
x
x	fprintf( TL_estream, "%s:  ", TL_name);
x
x	va_start( args);
x	_doprnt( fmt, args, TL_estream);
x	va_end( args);
x
x	wexit( TL_ecode);
x}
SHAR_EOF
if test 530 -ne "`wc -c 'err.c'`"
then
	echo shar: error transmitting "'err.c'" '(should have been 530 characters)'
fi
chmod +x 'err.c'
echo shar: extracting "'fman.man'" '(1807 characters)'
if test -f 'fman.man'
then
	echo shar: over-writing existing file "'fman.man'"
fi
sed 's/^x//' << \SHAR_EOF > 'fman.man'
x.TH FMAN 1T
x.SH NAME
xfman \- fast man command
x.SH SYNOPSIS
x.nf
x.B fman [-w] [section] title ...
x.fi
x.SH DESCRIPTION
x\fIFman\fR searches the system and local manual directories and prints
xmanual pages.  As of yet no fancy typesetting options are provided.
xThe -w option causes \fIfman\fR to list the full pathnames of all files
xit can find matching the description.
x.PP
xIf a section is specified, only those manual directories that could
xcontain pages of that section are searched.  This can speed things up.
xA section name is a string, usually a digit (UNIX manual section)
xfollowed by zero or one letters.  Section letters "lupam" correspond
xto local, user manual, programmer's manual, administrator's manual and
xadministrator's commands respectively.  Numbers correspond to the
xUNIX manual section.  Omitting the section letter will cause the
xspecified section in all UNIX manuals to be searched.
x.PP
x\fIFman\fR is 3 to 4 times faster in CPU cycles and 5 to 7 times faster in
xresponse time.  If the section is explicitly given it is even faster.
x.PP
xWhen it finds a file to print, the process to do the printing or formatting
xis run asynchronously, and the main program goes ahead and keeps searching
xdirectories.  This makes it appear faster.  (If there is a process printing,
xand another page is found, the search process will block until the first
xprinting process has exited and the second can start.)
x.SH EXAMPLES
xfman cat
x.SH SEE ALSO
xman(1) (but use fman or you'll wait a long time)
x.SH BUGS
xThe search directories are hard coded.  Should have more built in knowledge
xand recursive searching.  I have thought of a prettier way of writing this
xcommand.
x.PP
x.SH NOTES
xProfiling tells me that judicious tuning may allow me to shave a quarter
xof a cpu second off the average run.
x.SH AUTHOR
xTracy Tims
SHAR_EOF
if test 1807 -ne "`wc -c 'fman.man'`"
then
	echo shar: error transmitting "'fman.man'" '(should have been 1807 characters)'
fi
chmod +x 'fman.man'
echo shar: extracting "'globals.c'" '(298 characters)'
if test -f 'globals.c'
then
	echo shar: over-writing existing file "'globals.c'"
fi
sed 's/^x//' << \SHAR_EOF > 'globals.c'
x/*
x *	tools
x *
x *	globals.c - global hidden variables for tools
x *
x *	Author
x *
x *		         	tracy@hcr		Tracy Tims
x *
x *	Changes
x *
x *		dd mmm yy	user@site		real name
x *				description
x */
x
x#include <stdio.h>
x#include <tools.h>
x
xchar	*TL_name = "cmd";
xint	TL_ecode = 1;
xFILE	*TL_estream = stderr;
SHAR_EOF
if test 298 -ne "`wc -c 'globals.c'`"
then
	echo shar: error transmitting "'globals.c'" '(should have been 298 characters)'
fi
chmod +x 'globals.c'
echo shar: extracting "'main.c'" '(3048 characters)'
if test -f 'main.c'
then
	echo shar: over-writing existing file "'main.c'"
fi
sed 's/^x//' << \SHAR_EOF > 'main.c'
x/*
x *	fman
x *
x *	main.c - main program
x *
x *	Author
x *
x *		18 Oct 84	tracy@hcr		Tracy Tims
x *
x *	Changes
x *
x *		dd mmm yy	user@site		real name
x *				description
x */
x
x#include <stdio.h>
x#include "defs.h"
x#include "table.h"
x#include "tools.h"
x
xmain( argc, argv)
x	int		argc;
x	char		*argv[];
x{
x	char		*section = "";
x	extern int	optind;
x	extern char	*optarg;
x	int		c;
x	int		where_flag = False;
x	int		arg_errors = False;
x	int		found_any = False;
x	char		*strchr();
x
x	register int	i;
x	register int	mti;
x
x	program_id( *argv);
x
x	while ( (c = getopt( argc, argv, "w")) != EOF ) {
x		switch ( c ) {
x		case 'w':
x			where_flag = True;
x			break;
x		case '?':
x			arg_errors = True;
x			break;
x		}
x	}
x
x	if ( arg_errors )
x		usage();
x
x	argv += optind;
x
x	if ( argv[0] == (char *) 0 )
x		usage();
x
x	/*
x	 *	Test the first argument to see if it is a section
x	 *	name.
x	 */
x
x	for ( mti = 0; mt[mti].m_sec != (char *) 0; ++mti ) {
x		if ( is_sec( argv[0], mt[mti].m_sec) ) {
x			section = argv[0];
x			++argv;
x			break;
x		}
x	}
x
x	if ( argv[0] == (char *) 0 )
x		usage();
x
x	for ( i = 0; argv[i] != (char *) 0; ++i ) {
x		int		found_this = False;
x
x		/*
x		 *	Take each keyword and search the directories for
x		 *	a possible match.  All directories are searched.
x		 */
x
x		for ( mti = 0; mt[mti].m_sec != (char *) 0; ++mti ) {
x			if ( lookin( argv[i], &mt[mti], where_flag, section) ) {
x				found_this = True;
x				found_any = True;
x			}
x		}
x		if ( !found_this ) {
x			waitfor();
x			msg( "no manual entry for %s\n", argv[i]);
x		}
x	}
x	wexit( found_any ? 0 : 1);
x}
x
xlookin( file, mtp, where_flag, section)
x	char			*file;
x	struct man_table	*mtp;
x	int			where_flag;
x	char			*section;
x{
x
x	if ( !is_sec( section, mtp->m_sec) )
x		return( False);
x
x	if ( where_flag ) 
x		return( search( file, mtp->m_cdir, NO_FUNC, F_PATH)
x		|| search( file, mtp->m_dir, NO_FUNC, F_PATH) );
x
x	if ( mtp->m_dir != (char *) 0 )
x		if ( search( file, mtp->m_dir, mtp->m_com, F_FUNC) )
x			return( True);
x
x	if ( mtp->m_cdir != (char *) 0 )
x		if ( search( file, mtp->m_cdir, mtp->m_ccom, F_FUNC) )
x			return( True);
x
x	return( False);
x}
x
xusage()
x{
x	err( "usage:  tman [flags] [section] page ...\n");
x}
x
xwexit( c)
x	int		c;
x{
x	waitfor();
x	exit( c);
x}
x
x/*
x *	is_sec
x *
x *	Takes a section and a list of sections separated by blanks
x *	and determines whether or not the section is in
x *	the list.  Note that the section is in the list if it is
x *	a prefix of a section in the list.
x */
x
xis_sec( sec, secl)
x	char		*sec;
x	char		*secl;
x{
x	char		*secp;
x	char		*seclp = secl;
x
x	/*
x	 *	We find each section name in the section list.  For
x	 *	each name we compare the section candidate.  If the
x	 *	section candidate is a prefix of the section name in
x	 *	the list a match occurs.
x	 */
x
x	for (;;) {
x		secp = sec;
x		while ( *secp != '\0' ) {
x			if ( *secp != *seclp )
x				break;
x			++secp;
x			++seclp;
x		}
x		if ( *secp == '\0' )
x			return ( True );
x		/* now find the next entry in the list */
x		while ( *seclp != '\0' && *seclp != ' ' )
x			++seclp;
x		if ( *seclp == '\0' )
x			return ( False );
x		while ( *seclp == ' ' )
x			++seclp;
x	}
x}	
SHAR_EOF
if test 3048 -ne "`wc -c 'main.c'`"
then
	echo shar: error transmitting "'main.c'" '(should have been 3048 characters)'
fi
echo shar: extracting "'msg.c'" '(447 characters)'
if test -f 'msg.c'
then
	echo shar: over-writing existing file "'msg.c'"
fi
sed 's/^x//' << \SHAR_EOF > 'msg.c'
x/*
x *	tools
x *
x *	msg - message function
x *
x *	Author
x *
x *		27 Aug 84	tracy@hcr		Tracy Tims
x *
x *	Changes
x *
x *		dd mmm yy	user@site		real name
x *				description
x */
x
x#include <stdio.h>
x#include <varargs.h>
x#include "tools.h"
x
xextern int		_doprnt();
x
x/*VARARGS2*/
xmsg( fmt, va_alist)
x	char		*fmt;
x	va_dcl
x{
x	va_list		args;
x
x	fprintf( TL_estream, "%s:  ", TL_name);
x
x	va_start( args);
x	_doprnt( fmt, args, TL_estream);
x	va_end( args);
x
x	return;
x}
SHAR_EOF
if test 447 -ne "`wc -c 'msg.c'`"
then
	echo shar: error transmitting "'msg.c'" '(should have been 447 characters)'
fi
chmod +x 'msg.c'
echo shar: extracting "'output.c'" '(1561 characters)'
if test -f 'output.c'
then
	echo shar: over-writing existing file "'output.c'"
fi
sed 's/^x//' << \SHAR_EOF > 'output.c'
x/*
x *	fman - fast manual program
x *
x *	output.c - output routines
x *
x *		Each output routine should take as one argument a
x *	pathname to output.  Generally they are a rewritten version
x *	of system(3S).
x *
x *		The variable "pid" is used to interlock the asynch
x *	printing of entries.  Pid should be checked before anything
x *	is spawned, by waiting on it.  When an output routine is
x *	called it checks to see if there are any children (doing
x *	output) and waits if there are.  If there are none, it
x *	forks and returns asynchronously to look for more pages.
x *
x *	Author
x *
x *		19 Oct 84	tracy@hcr		Tracy Tims
x *
x *	Changes
x *
x *		dd mmm yy	user@site		real name
x *				description
x */
x
x#include <stdio.h>
x#include <tools.h>
x#include <output.h>
x#include <defs.h>
x#include <signal.h>
x
xstatic char		pid;
x
xwaitfor()
x{
x	extern int	wait();
x	int		status;
x	int		w;
x
x	while((w = wait(&status)) != pid && w != -1)
x		;
x}
x
xpcat( file)
x	char		*file;
x{
x	extern int	fork();
x	extern int	execl();
x
x	waitfor();
x
x	if((pid = fork()) == 0) {
x		(void) execl(P_PCAT, N_PCAT, file, (char *) 0);
x		err( "error:  can't exec pcat\n");
x	}
x	return;
x}
x
xnroff( file)
x	char		*file;
x{
x	extern int	fork();
x	extern int	execl();
x
x	waitfor();
x
x	if((pid = fork()) == 0) {
x		(void) execl(P_NROFF, N_NROFF, M_NROFF, file, (char *) 0);
x		err( "error:  can't exec nroff\n");
x	}
x
x	return;
x}
x
xcat( file)
x	char		*file;
x{
x	extern int	fork();
x	extern int	execl();
x
x	waitfor();
x
x	if((pid = fork()) == 0) {
x		(void) execl(P_CAT, N_CAT, file, (char *) 0);
x		err( "error:  can't exec cat\n");
x	}
x
x	return;
x}
SHAR_EOF
if test 1561 -ne "`wc -c 'output.c'`"
then
	echo shar: error transmitting "'output.c'" '(should have been 1561 characters)'
fi
echo shar: extracting "'output.h'" '(541 characters)'
if test -f 'output.h'
then
	echo shar: over-writing existing file "'output.h'"
fi
sed 's/^x//' << \SHAR_EOF > 'output.h'
x/*
x *	fman - fast manual command
x *
x *	output.h - declarations of output programs
x *
x *		There is an output program associated with each directory
x *	in the man_table.  To print a document the output program is
x *	called with the pathname of the document as an argument.
x *
x *	Author
x *
x *		19 Oct 84	tracy@hcr		Tracy Tims
x *
x *	Changes
x *
x *		dd mmm yy	user@site		real name
x *				description
x */
x
xextern int	pcat();		/* invoke pcat command			*/
xextern int	cat();		/* invoke cat command			*/
xextern int	nroff();	/* invoke nroff command			*/
SHAR_EOF
if test 541 -ne "`wc -c 'output.h'`"
then
	echo shar: error transmitting "'output.h'" '(should have been 541 characters)'
fi
echo shar: extracting "'search.c'" '(1867 characters)'
if test -f 'search.c'
then
	echo shar: over-writing existing file "'search.c'"
fi
sed 's/^x//' << \SHAR_EOF > 'search.c'
x/*
x *	fman
x *
x *	search.c - directory search functions
x *
x *	Author
x *
x *		18 Oct 84	tracy@hcr		Tracy Tims
x *
x *	Changes
x *
x *		dd mmm yy	user@site		real name
x *				description
x */
x
x#include <stdio.h>
x#include <defs.h>
x#include <ndir.h>
x#include <table.h>
x#include <tools.h>
x
x/*
x *	search
x *
x *	Search the given directory for all occurances of the file
x *	given (matched without the basename).  For each found manual
x *	page execute the function given with the pathname of the
x *	manual page as an argument.
x */
x
xsearch( file, dir, command, function)
x	char		*file;
x	char		*dir;
x	int		(*command)();
x	int		function;
x{
x	char		fullname[PATHSIZE];
x	register char	*basepart = fullname;
x	char		stripped_name[PATHSIZE];
x	struct direct	*ds;
x	DIR		*d;
x	char		*strip();
x	char		*strcpy();
x	int		found = False;
x
x	if ( command == NO_FUNC && function == F_FUNC )
x		err( "table entry with no function\n");
x
x	if ( (d = opendir( dir)) == (DIR *) 0 )
x		return( 0);
x
x	while ( *dir != '\0' ) {
x		*basepart++ = *dir++;
x	}
x		*basepart++ = '/';
x
x	while ( (ds = readdir( d)) != (struct direct *) 0 ) {
x		strcpy( basepart, ds->d_name);
x		strip( stripped_name, basepart);
x		if ( streq( stripped_name, file) ) {
x			found = True;
x			switch ( function ) {
x			case F_FUNC:
x				strcpy( basepart, ds->d_name);
x				(*command)( fullname);
x				break;
x			case F_PATH:
x				printf( "%s\n", fullname);
x				break;
x			}
x		}
x	}
x	closedir( d);
x	return ( found );
x}
x
xchar *
xstrip( buffer, filename)
x	char		*buffer;
x	char		*filename;
x{
x	char		*strrchr();
x	char		*strcpy();
x	char		*period;
x
x	strcpy( buffer, filename);
x
x	/*
x	 *	If there is a .z remove it, then remove the
x	 *	extension.
x	 */
x
x	if ( (period = strrchr( buffer, '.')) != (char *) 0 ) {
x		if ( period[1] == 'z' && period[2] == '\0' )
x			*period = '\0';
x	}
x
x	if ( (period = strrchr( buffer, '.')) != (char *) 0 )
x		*period = '\0';
x
x	return( buffer);
x}
SHAR_EOF
if test 1867 -ne "`wc -c 'search.c'`"
then
	echo shar: error transmitting "'search.c'" '(should have been 1867 characters)'
fi
echo shar: extracting "'table.c'" '(3250 characters)'
if test -f 'table.c'
then
	echo shar: over-writing existing file "'table.c'"
fi
sed 's/^x//' << \SHAR_EOF > 'table.c'
x/*
x *	fman - fast manual command
x *
x *	table.c - contains the search table
x *
x *	Author
x *
x *		19 Oct 84	tracy@hcr		Tracy Tims
x *
x *	Changes
x *
x *		dd mmm yy	user@site		real name
x *				description
x */
x
x/*
x *	M A N U A L   P A G E   S E A R C H   T A B L E
x *
x *	Each entry contains:
x *
x *		section_list,
x *			slow_directory,		slow_function,
x *			fast_directory,		fast_function,
x *
x *	Last entry should be:
x *
x *		MT_END
x *
x *	Each entry in the man_table describes a pair of directories
x *	which contain manual pages.  The files in the directories
x *	should be named <page>.<ext>[.z], where <page> is the name
x *	of the manual page and <ext> is an arbitrary extension.  The
x *	trailing .z is optional.
x *
x *	The section_list is a character string specifing the sections
x *	that may be in the associated directories.  If a section is
x *	specified by a user, only those entries that have that section
x *	in their section_list will be used.
x *
x *	The fast_directory is always searched first.  If any manual
x *	entries are found in the fast_directory, the slow_directory
x *	is not searched.  If a directory entry is NO_DIR, no search
x *	takes place.
x *
x *	When a manual entry is found in a directory, the function
x *	associated with that directory is executed.  It's argument
x *	is a character pointer to the full pathname of the file
x *	containing the manual entry.
x *
x *	The output function declarations are in output.h and their
x *	definitions are in output.c.
x */
x
x#include <table.h>
x#include <output.h>
x
xstruct man_table mt[] = {
x	"1t 1T",
x		"/u2/tracy/man/cat1",			cat,
x		NO_DIR,					NO_FUNC,
x	"3t 3T",
x		"/u2/tracy/man/cat3",			cat,
x		NO_DIR,					NO_FUNC,
x	"1l 1L",
x		"/usr/local/usr/man/u_man/man1",	nroff,
x		"/usr/local/usr/catman/u_man/man1",	pcat,
x	"6l 6L",
x		"/usr/local/usr/man/u_man/man6",	nroff,
x		"/usr/local/usr/catman/u_man/man6",	pcat,
x	"1l 1L",
x		"/usr/local/usr/man/a_man/man1",	nroff,
x		"/usr/local/usr/catman/a_man/man1",	pcat,
x	"7l 7L",
x		"/usr/local/usr/man/a_man/man7",	nroff,
x		"/usr/local/usr/catman/a_man/man7",	pcat,
x	"8l 8L",
x		"/usr/local/usr/man/a_man/man8",	nroff,
x		"/usr/local/usr/catman/a_man/man8",	pcat,
x	"2l 2L",
x		"/usr/local/usr/man/p_man/man2",	nroff,
x		"/usr/local/usr/catman/p_man/man2",	pcat,
x	"3l 3L",
x		"/usr/local/usr/man/p_man/man3",	nroff,
x		"/usr/local/usr/catman/p_man/man3",	pcat,
x	"4l 4L",
x		"/usr/local/usr/man/p_man/man4",	nroff,
x		"/usr/local/usr/catman/p_man/man4",	pcat,
x	"5l 5L",
x		"/usr/local/usr/man/p_man/man5",	nroff,
x		"/usr/local/usr/catman/p_man/man5",	pcat,
x	"1u 1U",
x		"/usr/man/u_man/man1",			nroff,
x		"/usr/catman/u_man/man1",		pcat,
x	"6u 6U",
x		"/usr/man/u_man/man6",			nroff,
x		"/usr/catman/u_man/man6",		pcat,
x	"5p 5P",
x		"/usr/man/p_man/man5",			nroff,
x		"/usr/catman/p_man/man5",		pcat,
x	"2p 2P",
x		"/usr/man/p_man/man2",			nroff,
x		"/usr/catman/p_man/man2",		pcat,
x	"3p 3P",
x		"/usr/man/p_man/man3",			nroff,
x		"/usr/catman/p_man/man3",		pcat,
x	"4p 4P",
x		"/usr/man/p_man/man4",			nroff,
x		"/usr/catman/p_man/man4",		pcat,
x	"1m 1M 1a 1A",
x		"/usr/man/a_man/man1",			nroff,
x		"/usr/catman/a_man/man1",		pcat,
x	"7a 7A",
x		"/usr/man/a_man/man7",			nroff,
x		"/usr/catman/a_man/man7",		pcat,
x	"8a 8A",
x		"/usr/man/a_man/man8",			nroff,
x		"/usr/catman/a_man/man8",		pcat,
x	MT_END
x};
SHAR_EOF
if test 3250 -ne "`wc -c 'table.c'`"
then
	echo shar: error transmitting "'table.c'" '(should have been 3250 characters)'
fi
echo shar: extracting "'table.h'" '(490 characters)'
if test -f 'table.h'
then
	echo shar: over-writing existing file "'table.h'"
fi
sed 's/^x//' << \SHAR_EOF > 'table.h'
x/*
x *	fman - fast manual program
x *
x *	table.h - header file for the search table
x *
x *	Author
x *
x *		19 Oct 84	tracy@hcr		Tracy Tims
x *
x *	Changes
x *
x *		dd mmm yy	user@site		real name
x *				description
x */
x
xstruct man_table {
x	char		*m_sec;
x	char		*m_cdir;
x	int		(*m_ccom)();
x	char		*m_dir;
x	int		(*m_com)();
x};
x
x#define NO_DIR		(char *) 0
x#define NO_FUNC		(int (*)()) 0
x#define MT_END		(char *) 0, NO_DIR, NO_FUNC, NO_DIR, NO_FUNC
x
xextern char		sections[];
xextern struct man_table	mt[];
SHAR_EOF
if test 490 -ne "`wc -c 'table.h'`"
then
	echo shar: error transmitting "'table.h'" '(should have been 490 characters)'
fi
echo shar: extracting "'tools.h'" '(767 characters)'
if test -f 'tools.h'
then
	echo shar: over-writing existing file "'tools.h'"
fi
sed 's/^x//' << \SHAR_EOF > 'tools.h'
x/*
x *	tools
x *
x *	tools.h - definitions for the use of tools
x *
x *	Author
x *
x *		27 Aug 84	tracy@hcr		Tracy Tims
x *
x *	Changes
x *
x *		dd mmm yy	user@site		real name
x *				description
x */
x
xextern char	*strsave();
xextern char	*basename();
xextern char	*TL_name;
xextern int	TL_ecode;
xextern FILE	*TL_estream;
x
x/*
x *	Useful macros
x */
x
x#ifndef NULL
x#define NULL		0
x#endif
x
x#define streq(s1,s2)	(!strcmp(s1,s2))
x#define strneq(s1,s2,l)	(!strncmp(s1,s2,l))
x#define prefix(s1,s2)	(!strncmp(s1,s2,strlen(s2)))
x#define strfree(x)	(free(x))
x
x/*
x *	Standard boolean values.
x */
x
x#define True		1
x#define False		0
x
x/*
x *	Defines for err, msg, syserr, sysmsg.
x */
x
x#define program_id(n)	(TL_name = (n))
x#define err_exit(n)	(TL_ecode = (n))
x#define err_stream(n)	(TL_estream = (n));
SHAR_EOF
if test 767 -ne "`wc -c 'tools.h'`"
then
	echo shar: error transmitting "'tools.h'" '(should have been 767 characters)'
fi
chmod +x 'tools.h'
#  --------- End of shell archive ----------
exit 0