1
/**********************************************************************/
2
/*** FILE : Help.c ***/
3
/*** AUTHOR: Trent Whiteley ***/
6
/*** PUBLIC ROUTINES: ***/
8
/*** PRIVATE ROUTINES: ***/
9
/*** char * getHelp(); ***/
10
/*** void displayHelp(); ***/
11
/*** MODULE DESCRIPTION: ***/
12
/*** This module contains routines used to handle the help ***/
13
/*** system for albert. ***/
14
/**********************************************************************/
23
initscr(); /* initialize LINES and COLS */
26
clear(); /* clear the buffer */
27
refresh(); /* display the buffer */
34
char str[80], *helpPtr, *test;
43
strcpy(str, "H"); /* if no topic, display menu */
49
helpPtr = getHelp(str);
51
displayHelp(helpPtr, helpLines, helpCols);
54
printf("No help is available for %s\n", str);
56
printf(" Type a letter for help, or carriage return to\n return\
57
to the Albert session.\n\n\nHELP--> ");
59
test = fgets(str, 80, stdin);
60
str[strlen(str)-1] = '\0';
68
char * getHelp(helpRqst)
73
for(i = 0; i < NUM_COMMANDS; ++i){
74
if(!strncmp(helpRqst, Help_lines[i].help_topic, strlen(helpRqst))){
75
return(Help_lines[i].help_text);
84
void displayHelp(helpPtr, rows, cols)
89
char line[500 + 1], *blank, *pos = helpPtr;
90
int i, j, done, blankNdx;
92
for(j = 0; *pos; ++j){
93
for(i = 0, done = FALSE, blankNdx = 0; i < cols && *pos && !done; ++i,
95
if(*pos == ' ' || *pos == '\t'){
96
blank = pos; /* set blank to point to most current white space */
97
blankNdx = i; /* save the index to the last white space */
99
else if(*pos == '\n'){
104
if(*(pos-1) == '\n'){ /* substitute EOL for CRLF */
107
else if(blankNdx != 0){ /* set EOL at last white space encountered */
108
line[blankNdx] = '\0';
111
else{ /* if no white space encountered, break up the word */
112
line[cols + 1] = '\0';
114
printf("%s\n", line); /* write the line */
116
j += 3; /* increment the row counter */
117
printf("\nHit Return to continue-->"); /* print more message at
118
bottom left of screen */
122
j = 0; /* reset the line number */
131
if(*lines >= helpLines-2){
133
printf("\nHit Return to continue-->"); /* print more message at
134
bottom left of screen */
147
for(i = 0; i < helpLines; ++i){