home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #ifdef VMS
- #include <stat.h>
- #else
- #include <sys/types.h>
- #include <sys/stat.h>
- #endif
- #include "window.h"
- #include "file.h"
- #include "display.h"
- #include "line.h"
- #include "most.h"
-
- #ifndef MOST_HELP_USE_DOC
- /* This section provided by Mats Akerberg (mats@efd.lth.se) */
-
- static char *help[] = {
- "SPACE,^D,D,d *Scroll down one Screen.",
- "RETURN, DOWN *Move forward one line.",
- "u,U,^U, DELETE *Move Up one screen.",
- "UP *Move up one line.",
- "R, r, ^R Redraw Screen.",
- "T,t Top of File.",
- "B,b Bottom of file.",
- "RIGHT Scroll Screen Left (to view lines right of right margin)",
- "LEFT Scroll Screen Right (To view lines left of left margin)",
- "F,f,/ *Find forward",
- "? *Find Backward",
- "n,N *Find next in current search direction.",
- "J,j,g,G Goto line.",
- "% Goto percent.",
- "q,Q Quit MOST.",
- ":N,:n Quit this file and view next.",
- " *Note: This command may be repeated `n' times By entering a number then",
- " the command key, e.g., '5 SPACE' moves 5 screens forward.",
- NULL };
-
- void do_help_command()
- {
- int i,ct;
- char *beg, *end;
- char line[80];
- char attr[80];
-
- i = 1;
- ct = 0;
- set_scroll_region(1,SCREEN_HEIGHT);
- cls();
- while( i<SCREEN_ROWS)
- {
- if( help[ct]!=NULL)
- {
- beg = help[ct];
- end = (help[ct] + strlen(help[ct++]));
- analyse_line((unsigned char *) beg, (unsigned char *) end, line, attr);
- output(line,end - beg,attr,'$');
- fputc('\n',stdout);
- i++;
- }
- else
- {
- set_attribute(7);
- fputs("Press any key to continue.",stdout);
- set_attribute(0);
- fflush(stdout);
- getkey();
- redraw_display();
- return;
- }
- fflush(stdout);
- }
- }
-
- #else
- void do_help_command()
- {
- int fd, n_lines,s_lines,v_opt,b_opt,t_opt, sd, a_lines, fsize, c_line;
- char *helpfile ,*buf_name,f_name[80],s_str[80];
- unsigned char *beg, *c_pos, *e_pos;
- extern char *getenv(char *);
-
- buf_name = "*help*";
- helpfile = getenv("MOST_HELP");
- if (helpfile == NULL)
- {
- static char tempname[L_tmpnam];
- struct stat statb;
-
- head(MOST_PROGRAM, tempname);
- strcat(tempname, "most.doc");
- if (0 == stat(tempname, &statb))
- {
- helpfile = tempname;
- }
- }
- if (helpfile != NULL)
- {
- if (file_visible(buf_name)) return;
- if (!split_window())
- {
- message("Two many windows.",1);
- return;
- }
- update_status(1); /* create status line of prev. window */
- other_window(1);
- (void) find_file(helpfile);
- strcpy(BUF->file,buf_name);
- window_buffer();
- redraw_window();
- update_status(1);
- }
- else
- {
- message("You must set the environment variable 'MOST_HELP' to point to the help file.",1);
- }
- }
- #endif
-