[comp.sources.amiga] v89i038: man - show manual entries v2.0

page@swan.ulowell.edu (Bob Page) (03/09/89)

Submitted-by: barrett@cs.jhu.edu (Dan Barrett)
Posting-number: Volume 89, Issue 38
Archive-name: unix/man20.1

Here is my simple, yet extremely useful, "port" of the UNIX "man"
command.  Version 1.0 has been in the Public Domain for a long time,
and here is the most recent (and probably final) version.

[uuencoded executable included.  ..Bob]

#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar:    Shell Archiver
#	Run the following text with /bin/sh to create:
#	Man.c
#	Man.uu
#	README
#	man.doc
# This archive created: Wed Mar  8 15:10:33 1989
cat << \SHAR_EOF > Man.c
/***************************************************************************
 * MAN.C:	Find documentation on a particular subject.
 *
 * Author:	Daniel Barrett, barrett@cs.jhu.edu (ARPANET).
 *		PUBLIC DOMAIN.
 *
 * Usage:	MAN [-d directory] subject_1 subject_2 ...
 *
 *		The subdirectories of MAN: listed in *subDirs[], below,
 *		are checked for the files subject_1, subject_2, ....
 *		When a file is found, it is displayed using a text
 *		display program "MORE" (#defined below).
 *
 *		Use the "-d directory" to confine the search to only ONE
 *		subdirectory of MAN:.
 *
 * Note:	You must assign MAN: to an existing volume or directory.
 *		You must also have the "MORE" program in your search path.
 *
 * Compiling:	cc man.c		(MANX)
 *		ln man.o -lc
 *
 **************************************************************************/

#include <stdio.h>

#define	VERSION		"2.0"

#define	MANDIR		"MAN:"		/* Your Manual directory.     */
#define	MORE		"more"		/* Your file viewing program. */
#define MISSING(f)	(access(f,0))
#define EXISTS(f)	(!access(f,0))
#define EQUAL		!strcmp
#define DIRFLAG		"-d"
#define HELPFLAG	"?"
#define	TRUE		1
#define	FALSE		0
	
static char *subDirs[] = { "Tools", "Utilities", "ARP", "Graphics", "Sound",
			   "UNIX", "Games", "WB", "Misc", NULL };
	
main(argc,argv)
int argc;
char *argv[];
{
	char subject[BUFSIZ];
	char *CheckAllSubdirs(), *MakeManPageName();
	int i;
	
	if (BadArgs(argc, argv))
		Usage("MAN", subDirs);
	else if (EQUAL(argv[1], DIRFLAG))
		for (i=3; i<argc; i++) {
			strcpy(subject, 
			       MakeManPageName(MANDIR, argv[2], argv[i]));
			Man(subject, subject);
		}
	else
		for (i=1; i<argc; i++) {
			strcpy(subject, 
			       CheckAllSubdirs(MANDIR, subDirs, argv[i]));
			Man(subject, argv[i]);
		}
}


BadArgs(argc, argv)
int argc; char *argv[];
{
	if ((argc < 2)
	||  (EQUAL(argv[1], HELPFLAG))
	||  (EQUAL(argv[1], DIRFLAG) && (argc < 4)))
		return(TRUE);
	else
		return(FALSE);
}

	
Usage(progName, subdirs)
char *progName, *subdirs[];
{
	printf("%s V%s by Daniel Barrett.  100%% PUBLIC DOMAIN.\n",
		progName, VERSION);
	printf("Find documentation on a particular subject.\n\n");
	printf("Usage:  %s [-d directory] subject_1 subject_2 ...\n",
		progName);
	printf("%s searches these subdirectories of %s, in order:\n\t",
		progName, MANDIR);
	while (*subdirs)
		printf("%s ", *(subdirs++));
	printf("\n");
	exit(5);
}

	
char *CheckAllSubdirs(prefix, subdir, filename)
/* Return the subdir name containing the filename; NULL otherwise. */
char *prefix, *subdir[], *filename;
{
	char winner[BUFSIZ], *MakeManPageName();

	while (*subdir) {
		strcpy(winner, MakeManPageName(prefix, *subdir, filename));
		if EXISTS(winner)
			return(winner);
		else
			subdir++;
	}

	if (!(*subdir))			/* We found nothing. */
		return(NULL);
	else
		return(winner);		/* Should never happen...
					 *  but just to be sure. */
}

char *MakeManPageName(prefix, subdir, filename)
char *prefix, *subdir, *filename;
{
	char buf[BUFSIZ];

	strcpy(buf, prefix);
	if (!EndsWith(prefix, ':') && !EndsWith(prefix, '/'))
		strcat(buf, "/");
	if (!EQUAL(subdir, NULL)) {
		strcat(buf, subdir);
		strcat(buf, "/");
	}
	strcat(buf, filename);
	return(buf);
}


Man(pathname, subject)
char *pathname, *subject;
{
	if ((pathname == NULL) || EQUAL(pathname, "") || MISSING(pathname))
		printf("Cannot find manual entry for %s.\n", subject);
	else
		fexecl(MORE, MORE, pathname, 0L);
}

	
EndsWith(str, c)
/* Does string "str" end with character "c"? */
char *str, c;
{
	return( (str[strlen(str)-1] == c) ? TRUE : FALSE);
}
SHAR_EOF
cat << \SHAR_EOF > Man.uu

begin 644 Man
M```#\P`````````#``````````(```:2````M0````$```/I```&DD[Z"8I4\
M;V]L<P!5=&EL:71I97,`05)0`$=R87!H:6-S`%-O=6YD`%5.25@`1V%M97,`'
M5T(`36ES8P!.5?O^+RT`"C\M``A.N@#X7$]*0&<22&R``DAZ`-A.N@$V4$]@7
M``#*2'H`SB!M``HO*``$3KH(PE!/2D!F5CM\``/[_F!","W[_DC`Y8`@;0`*R
M+S`(`"!M``HO*``(2'H`FTZZ`JI/[P`,+P!(;?P`3KH#U%!/2&W\`$AM_`!.&
MN@,:4$]2;?O^,"W[_K!M``AMM&!<.WP``?O^8$HP+?O^2,#E@"!M``HO,`@`B
M2&R``DAZ`$Y.N@'X3^\`#"\`2&W\`$ZZ`X)03S`M^_Y(P.6`(&T`"B\P"`!(F
M;?P`3KH"O%!/4FW[_C`M^_ZP;0`(;:Q.74YU34%.`"UD`$U!3CH`34%..@``A
M3E4```QM``(`"&TT2'H`/"!M``HO*``$3KH'V%!/2D!G'DAZ`"@@;0`*+R@`D
M!$ZZ!\)03TI`9@X,;0`$``AL!G`!3EU.=7``8/@_`"UD``!.50``2'H`KB\M/
M``A(>@!L3KH,9$_O``Q(>@">3KH,6%A/+RT`"$AZ`+Y.N@Q*4$](>@$;+RT`&
M"$AZ`-].N@PX3^\`#"!M``Q*D&<6(&T`#%BM``PO$$AZ`/I.N@P:4$]@XDAZE
M`/).N@P.6$\_/``%3KH54%1/3EU.=1M;,S-M)7,@5B5S&ULP;2!B>2!$86YI2
M96P@0F%R<F5T="X@(#$P,"4E(%!50DQ)0R!$3TU!24XN"@`R+C``1FEN9"!D2
M;V-U;65N=&%T:6]N(&]N(&$@<&%R=&EC=6QA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[O^R```#[`````$````!```*``````````/R```#4
MZ@```*`````$````"@```!0````8````(0```"<````L````,@```#4`````?
M,#$R,S0U-C<X.6%B8V1E9@```"`@("`@("`@(#`P,#`P("`@("`@("`@("`@R
M("`@("`@D$!`0$!`0$!`0$!`0$!`0`P,#`P,#`P,#`Q`0$!`0$!`"0D)"0D)^
M`0$!`0$!`0$!`0$!`0$!`0$!`0%`0$!`0$`*"@H*"@H"`@("`@("`@("`@("J
M`@("`@("`D!`0$`@``````````````````$``````0``````````````````P
M```!`0````$``````````````````````0(````!````````````````````'
M`````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````````````
M`````!0````````````````#[`````D```````````````0````(````#```D
F`!`````4````&````!P````@`````````_(```/K`````0```_((9
``
end
size 7508
SHAR_EOF
cat << \SHAR_EOF > README
*************************************************************************
* MAN.C:	A simple UNIX-like "man" command.
*		100% PUBLIC DOMAIN.  1-16-89
*		Daniel Barrett, barrett@cs.jhu.edu
*************************************************************************

Here is a VERY simple and short program inspired by the UNIX "man" command.
I got sick of continually hunting for documentation on programs, so I
put all the documentation files in a nicely-organized directory hierarchy.
This program makes it easy to find and read that documentation at any time.

I think this program will be most useful to people with hard drives, since
they can keep all your documentation on-line all the time.  However, it
is certainly useable from floppies.  Try it out and see!  You might just
name one floppy "MAN:" and keep all your documentation on it.

"Man" allows you to look up documentation for a command by saying:

		Man command-name

See the file "Man.doc" for more specific information.  See also the 
source code.

	Have fun, and feel free to make this program more sophisticated
if you want.

							Dan
SHAR_EOF
cat << \SHAR_EOF > man.doc
MAN(0)              Dan's Programmer's Manual               MAN(0)


NAME

	man - look up documentation on a command

SYNOPSIS

	man [-d directory] command_1 command_2 ... command_N
	man ?

DESCRIPTION

	"Man" looks in the volume or directory "MAN:" for information
	about the given commands, and then displays it on the screen.
	This is version 2.0.  Unlike the original version, "Man" now
	checks a defined set of subdirectories in MAN:, and not MAN:
	itself.  This makes organizing your documentation easier, and
	there is no noticeable decrease in search speed.  (Particularly
	on a hard drive with Fast Filesystem!)

	If you specify the "-d directory" option, only the named 
	subdirectory (in MAN:) is searched; any others are ignored.
	[Note:  if you want to search MAN: itself, not its subdirectories,
	you can type:
			Man -d "" command
	]

	When the requested documentation is found, it is displayed 
	using the program "More", found on the Amiga "Extras" disk.
	(Make sure that "More" is in your search path.)  You can use
	a different text display program by changing the value of "MORE"
	in the source code.  If no documentation is found, you are told.
	
	Typing "Man" or "Man ?" prints usage information, as well as
	the list of subdirectories (in MAN:) that it searches in order.
	These directory names are easily changed in the source code.

BEFORE USING MAN

	First, assign MAN: to some directory someplace.
	Second, type "Man" alone to see what subdirectories it searches.
	Create these subdirectories in MAN:.
	Third, put your documentation files in these subdirectories.

	THE NAME OF EACH DOCUMENTATION FILE MUST BE THE SAME AS THE NAME
	OF THE PROGRAM IT DOCUMENTS.

EXAMPLES

	Man list cd dir info

		Searches the subdirectories of MAN: for documentation files
		called "list", "cd", "dir", and "info", displaying them as 
		it finds them.

	Man -d Graphics DPaint Animator

		Searches only the directory MAN:Graphics for documentation
		files called "DPaint" and "Animator", displaying them as
		it finds them.

FILES

	MAN:		Manual directory.
	More		File viewing program, must be in your search path.
	c:Assign	For "Assign MAN: some-directory-of-your-choice".

COMPILING

	I used MANX C, with 16-bit integers:

		cc man.c
		ln man.o -lc

BUGS

	None that I know of.  It's a very simple program.

AUTHOR

	Daniel Barrett:  barrett@cs.jhu.edu, ins_adjb@jhunix.UUCP.
	Finished 1-16-89.
	MAN Executable program and source code are 100% PUBLIC DOMAIN.
SHAR_EOF
#	End of shell archive
exit 0
-- 
Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
Have five nice days.