home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
fish
/
telecom
/
uucp_442
/
src
/
dmail
/
help.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-08
|
3KB
|
149 lines
/*
* HELP.C
*
* $Header: Beta:src/uucp/src/dmail/RCS/help.c,v 1.1 90/02/02 12:04:12 dillon Exp Locker: dillon $
*
* (C) Copyright 1985-1990 by Matthew Dillon, All Rights Reserved.
*
* Global Routines: DO_HELP()
*
*/
#include <stdio.h>
#include "dmail.h"
#include "execom.h"
#include "config.h"
#ifdef AMIGA
#define HELPFILE "dmail.help"
#endif
#ifndef HELPFILE
static char *help[] = {
#include ".dmkout"
};
do_help()
{
int i, j;
char *ptr;
if (push_base()) {
push_break();
pop_base();
PAGER (-1);
pop_break();
return;
}
PAGER (0);
if (ac == 1) {
for (j = 0; help[j] && *help[j] != '.'; ++j)
PAGER (help[j]);
for (i = 0; Command[i].name != NULL; ++i) {
if (*Command[i].name && !(Command[i].stat & C_NO)) {
if (Desc[i] == NULL)
puts("Software error, premature EOF in description table");
sprintf (Puf, "%-10s %s", Command[i].name, Desc[i]);
PAGER (Puf);
}
}
}
PAGER ("");
for (i = 1; i < ac; ++i) {
j = 0;
again:
while (help[j] && *help[j] != '.')
++j;
if (help[j]) {
if (strncmp (av[i], help[j] + 1, strlen(av[i]))) {
++j;
goto again;
}
while (help[j] && *help[j] == '.')
++j;
while (help[j] && *help[j] != '.')
PAGER (help[j++]);
PAGER ("");
goto again;
}
}
PAGER (-1);
pop_base();
}
#else
do_help()
{
int i;
FILE *fi = NULL;
char *eof;
if (push_base()) {
push_break();
pop_base();
PAGER (-1);
if (fi != NULL) {
fclose (fi);
fi = NULL;
}
pop_break();
return (-1);
}
#ifdef AMIGA
fi = fopen (MakeConfigPath(UUMAN, HELPFILE), "r");
#else
fi = fopen (HELPFILE, "r");
#endif
if (fi == NULL) {
printf ("Cannot open help file: %s\n", HELPFILE);
PAGER (-1);
pop_base();
return (-1);
}
PAGER (0);
if (ac == 1) {
while (fgets (Puf, MAXFIELDSIZE, fi) && *Puf != '.')
FPAGER (Puf);
fclose (fi);
fi = NULL;
for (i = 0; Command[i].name != NULL; ++i) {
if (*Command[i].name) {
sprintf (Puf, "%-10s %s", Command[i].name, Desc[i]);
PAGER (Puf);
}
}
PAGER (-1);
pop_base();
return (1);
}
PAGER ("");
for (i = 1; i < ac; ++i) {
fseek (fi, 0, 0);
again:
while ((eof = fgets (Puf, MAXFIELDSIZE, fi)) && *Puf != '.');
if (!eof)
continue;
if (strncmp (av[i], Puf + 1, strlen(av[i])))
goto again;
while ((eof = fgets (Puf, MAXFIELDSIZE, fi)) && *Puf == '.');
if (!eof)
continue;
FPAGER (Puf);
while ((eof = fgets (Puf, MAXFIELDSIZE, fi)) && *Puf != '.')
FPAGER (Puf);
PAGER ("");
if (!eof)
continue;
goto again;
}
fclose (fi);
fi = NULL;
PAGER (-1);
pop_base();
}
#endif