home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / newemacs / help.c < prev    next >
Encoding:
C/C++ Source or Header  |  1980-01-01  |  1.4 KB  |  61 lines

  1. /* This is the help section */
  2. #include <stdio.h>
  3. #include "ed.h"
  4.  
  5. #define UPAROW  EXTKY|72
  6. #define DNAROW  EXTKY|80
  7. #define PAGEUP  EXTKY|73
  8. #define PAGEDN  EXTKY|81
  9. #define RETCODE CTRL|'M'
  10.  
  11. static char hfname[] ="emacs.hlp";
  12.  
  13. help(f,n)
  14. int f,n;
  15.     {
  16.     register int s;
  17.     register BUFFER *cbp;
  18.     register int kcode;
  19.     extern int sgarbf;
  20.     int getkey();
  21.     int forwline();
  22.     int backline();
  23.     int backpage();
  24.     int forwpage();
  25.     
  26.     /* save current buffer pointer */
  27.     cbp = curbp;
  28.     /* now visit the help file */
  29.     flvisit("emacs.hlp");
  30.     sgarbf = TRUE;
  31.     update();
  32.     /* this loop allows the user to browse the help file */
  33.     /* the only keystrokes that are active are the uparrow,downarrow,
  34.        pageup,pagedown, and return keys. all other keys do nothing */
  35.  
  36.     kcode=getkey();
  37.     while (kcode != (RETCODE))
  38.         {
  39.         switch (kcode)
  40.             {
  41.             case UPAROW:  backline(f,1);
  42.                           break;
  43.  
  44.             case DNAROW:  forwline(f,1);
  45.                           break;
  46.  
  47.             case PAGEUP:  backpage(f,1);
  48.                           break;
  49.  
  50.             case PAGEDN:  forwpage(f,1);
  51.                           break;
  52.  
  53.             default:
  54.                           break;
  55.             }
  56.         update();
  57.         kcode = getkey();
  58.         }
  59.     s = flvisit(cbp->b_fname);
  60.     }
  61.