Home | History | Annotate | Line # | Download | only in larn
help.c revision 1.1
      1  1.1  cgd /*	help.c		Larn is copyrighted 1986 by Noah Morgan. */
      2  1.1  cgd #include "header.h"
      3  1.1  cgd /*
      4  1.1  cgd  *	help function to display the help info
      5  1.1  cgd  *
      6  1.1  cgd  *	format of the .larn.help file
      7  1.1  cgd  *
      8  1.1  cgd  *	1st character of file:	# of pages of help available (ascii digit)
      9  1.1  cgd  *	page (23 lines) for the introductory message (not counted in above)
     10  1.1  cgd  *	pages of help text (23 lines per page)
     11  1.1  cgd  */
     12  1.1  cgd extern char helpfile[];
     13  1.1  cgd help()
     14  1.1  cgd 	{
     15  1.1  cgd 	register int i,j;
     16  1.1  cgd #ifndef VT100
     17  1.1  cgd 	char tmbuf[128];	/* intermediate translation buffer when not a VT100 */
     18  1.1  cgd #endif VT100
     19  1.1  cgd 	if ((j=openhelp()) < 0)  return;	/* open the help file and get # pages */
     20  1.1  cgd 	for (i=0; i<23; i++) lgetl();	/* skip over intro message */
     21  1.1  cgd 	for (;  j>0; j--)
     22  1.1  cgd 		{
     23  1.1  cgd 		clear();
     24  1.1  cgd 		for (i=0; i<23; i++)
     25  1.1  cgd #ifdef VT100
     26  1.1  cgd 			lprcat(lgetl());	/* print out each line that we read in */
     27  1.1  cgd #else VT100
     28  1.1  cgd 			{ tmcapcnv(tmbuf,lgetl());  lprcat(tmbuf); } /* intercept \33's */
     29  1.1  cgd #endif VT100
     30  1.1  cgd 		if (j>1)
     31  1.1  cgd 			{
     32  1.1  cgd 			lprcat("    ---- Press ");  standout("return");
     33  1.1  cgd 			lprcat(" to exit, ");  standout("space");
     34  1.1  cgd 			lprcat(" for more help ---- ");
     35  1.1  cgd 			i=0; while ((i!=' ') && (i!='\n') && (i!='\33')) i=getchar();
     36  1.1  cgd 			if ((i=='\n') || (i=='\33'))
     37  1.1  cgd 				{
     38  1.1  cgd 				lrclose();  setscroll();  drawscreen();  return;
     39  1.1  cgd 				}
     40  1.1  cgd 			}
     41  1.1  cgd 		}
     42  1.1  cgd 	lrclose();  retcont();  drawscreen();
     43  1.1  cgd 	}
     44  1.1  cgd 
     45  1.1  cgd /*
     46  1.1  cgd  *	function to display the welcome message and background
     47  1.1  cgd  */
     48  1.1  cgd welcome()
     49  1.1  cgd 	{
     50  1.1  cgd 	register int i;
     51  1.1  cgd #ifndef VT100
     52  1.1  cgd 	char tmbuf[128];	/* intermediate translation buffer when not a VT100 */
     53  1.1  cgd #endif VT100
     54  1.1  cgd 	if (openhelp() < 0)  return;   	/* open the help file */
     55  1.1  cgd 	clear();
     56  1.1  cgd 	for(i=0; i<23; i++)
     57  1.1  cgd #ifdef VT100
     58  1.1  cgd 			lprcat(lgetl());	/* print out each line that we read in */
     59  1.1  cgd #else VT100
     60  1.1  cgd 			{ tmcapcnv(tmbuf,lgetl());  lprcat(tmbuf); } /* intercept \33's */
     61  1.1  cgd #endif VT100
     62  1.1  cgd 	lrclose();  retcont();	/* press return to continue */
     63  1.1  cgd 	}
     64  1.1  cgd 
     65  1.1  cgd /*
     66  1.1  cgd  *	function to say press return to continue and reset scroll when done
     67  1.1  cgd  */
     68  1.1  cgd retcont()
     69  1.1  cgd 	{
     70  1.1  cgd 	cursor(1,24); lprcat("Press "); standout("return");
     71  1.1  cgd 	lprcat(" to continue: ");   while (getchar() != '\n');
     72  1.1  cgd 	setscroll();
     73  1.1  cgd 	}
     74  1.1  cgd 
     75  1.1  cgd /*
     76  1.1  cgd  *	routine to open the help file and return the first character - '0'
     77  1.1  cgd  */
     78  1.1  cgd openhelp()
     79  1.1  cgd 	{
     80  1.1  cgd 	if (lopen(helpfile)<0)
     81  1.1  cgd 		{
     82  1.1  cgd 		lprintf("Can't open help file \"%s\" ",helpfile);
     83  1.1  cgd 		lflush(); sleep(4);	drawscreen();	setscroll(); return(-1);
     84  1.1  cgd 		}
     85  1.1  cgd 	resetscroll();  return(lgetc() - '0');
     86  1.1  cgd 	}
     87  1.1  cgd 
     88