Category : C Source Code
Archive   : TCHELP.ZIP
Filename : TCHELP.C

 
Output of file : TCHELP.C contained in archive : TCHELP.ZIP
/*
tchelp.c
by Edward V Dong, 08 June 1987

-----------------------------------------------------------------------
tchelp.c is based on about.c, originally written for DeSmet C, but
converted to Turbo C version 1.0. The following is the original
discussion on about.c
-----------------------------------------------------------------------
Usage: about []

Examples: about calloc
about *
about * b:c.cat
about fourier b:math.dat

Description: For each line in beginning as ":",
successive lines are displayed until the next line
begins with ":"; if is *, all entries are
displayed; defaults to "about.dat".

Purpose: The file about.dat contains synopses of C functions,
thus making "about" an elementary "help facility".

However, may be any list of :'s of
interest, with each name on a separate line, and
each followed by its respective text to be displayed.

Limitations: A simple linear search is used, so probably no more
than a few hundred names can be handled usefully.

Language: C (DeSmet 2.4)

Author: R. E. Sawyer
3620 Spencer St. 30, Torrance, CA 90503
1 Jan 85
-----------------------------------------------------------------------
*/

#include

#define CATFILE "tc.dat"
#define DEFCHAR ':'
#define BUFLEN 82

FILE *fin;

main(ac, av)
int ac;
char *av[];
{
char *catfile, *more;
char buf[BUFLEN];
char *print_text();
int showall;
int done;

showall = 0;
done = 0;

if ((ac < 2) || (ac > 3))
{
printf("\nUsage: tchelp []\n");
printf("\nFor each line in beginning as \":\",");
printf("\nsuccessive lines are displayed until the next line");
printf("\nbegins with \":\"; if is *, all entries are");
printf("\ndisplayed; defaults to \"tc.dat\".\n");
printf("\nbased on original by R.E.Sawyer (about.c) revised");
printf("\nby Edward V. Dong, 8 June 1987, for Turbo C.\n");
exit();
}
else if (ac == 2)
{
if ((fin = fopen(catfile = CATFILE, "rb")) == 0)
{
printf("\n---File %s not found", catfile);
exit();
}
}
else if (ac ==3)
{
if ((fin = fopen(catfile = av[2], "rb")) == 0)
{
printf("\n---File %s not found", catfile);
exit();
}
}
if (*av[1] == '*')
showall = 1;
printf("\n(Catalogue file: %s)\n\n", catfile);
more = fgets(buf, BUFLEN - 1, fin);
while (more!=NULL)
{
if ((buf[0] == DEFCHAR)
&& ((comp(av[1], buf + 1) == 0) || showall))
{
more = print_text(buf);
if (!showall)
{
done = 1;
break;
}
}
else
more = fgets(buf, BUFLEN - 1, fin);
}
if ((done != 1) && !showall)
printf("\"%s\" is not catalogued\n\n", av[1]);
fclose(fin);
}

int comp(s, t)
char *s, *t;
{
int i;

for (i = 0; (t[i] > ' ') && (t[i] <= '~'); ++i)
;
t[i] = '\0';
return strcmp(s, t);
}

#include
char *print_text(buf)
char buf[];
{
char *more;
printf("%s:\n", &buf[1]);
while (((more = fgets(buf, BUFLEN - 1, fin)) != NULL)
&& (buf[0] != DEFCHAR))
{
if (strrchr(buf,10)!=NULL) *strrchr(buf,10) = 0;
puts(buf);
}
return more;
}


  3 Responses to “Category : C Source Code
Archive   : TCHELP.ZIP
Filename : TCHELP.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/