home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
341b.lha
/
uucp1_v1.03d
/
src
/
MUtil
/
man.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-01-28
|
1KB
|
63 lines
/*
* MAN.C
*
* MAN <topic>
*
* searches for MAN:topic or MAN:topic.Doc
*/
#include <stdio.h>
#include <stdlib.h>
#include <config.h>
#include "/version.h"
IDENT(".00");
void
main(ac, av)
char *av[];
{
short i;
static char Buf[256];
for (i = 1; i < ac; ++i) {
char *topic = av[i];
if (Man(topic) == 0) {
sprintf(Buf, "MAN:%s", topic);
if (Man(Buf) == 0) {
sprintf(Buf, "MAN:%s.Doc", topic);
if (Man(Buf) == 0)
printf("Unable to open MAN:%s or MAN:%s.Doc\n", topic, topic);
}
}
}
}
Man(file)
char *file;
{
FILE *fi = fopen(file, "r");
char *filter = FindConfig(RFILTER);
short rb = 1;
static char Cmd[256];
if (fi == NULL)
return(0);
if (filter == NULL) {
if ((filter = FindConfig(FILTER)) == NULL) {
printf("UULIB:Config, no 'Filter' entry\n");
return(0);
}
rb = 0;
}
fclose(fi);
if (rb)
sprintf(Cmd, "Run >nil: <nil: %s %s", filter, file);
else
sprintf(Cmd, "%s %s", filter, file);
Execute(Cmd, NULL, NULL);
}