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