home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 313_01 / help.c < prev    next >
C/C++ Source or Header  |  1990-04-22  |  9KB  |  308 lines

  1. /* $Header: /nw2/tony/src/stevie/src/RCS/help.c,v 1.10 89/08/31 10:00:20 tony Exp $
  2.  *
  3.  * Routine to display a command summary.
  4.  */
  5.  
  6. #include "stevie.h"
  7.  
  8. extern    char    *Version;
  9.  
  10. static    int    helprow;
  11.  
  12. #ifdef    HELP
  13.  
  14. static    void    longline();
  15.  
  16. bool_t
  17. help()
  18. {
  19.  
  20. /***********************************************************************
  21.  * First Screen:   Positioning within file, Adjusting the Screen
  22.  ***********************************************************************/
  23.  
  24.     outcstr(T_ED);
  25.     windgoto(helprow = 0, 0);
  26.  
  27. longline("\
  28.    Positioning within file\n\
  29.    =======================\n\
  30.       ^F             Forward screenfull             Developed by:\n\
  31.       ^B             Backward screenfull                Tony Andrews\n");
  32. longline("\
  33.       ^D             scroll down half screen\n\
  34.       ^U             scroll up half screen          Based on a program by:\n");
  35. longline("\
  36.       G              Goto line (end default)            Tim Thompson\n\
  37.       ]]             next function\n\
  38.       [[             previous function\n\
  39.       /re            next occurence of regular expression 're'\n");
  40. longline("\
  41.       ?re            prior occurence of regular expression 're'\n\
  42.       n              repeat last / or ?\n\
  43.       N              reverse last / or ?\n\
  44.       %              find matching (, ), {, }, [, or ]\n");
  45. longline("\
  46. \n\
  47.    Adjusting the screen\n\
  48.    ====================\n\
  49.       ^L             Redraw the screen\n\
  50.       ^E             scroll window down 1 line\n\
  51.       ^Y             scroll window up 1 line\n");
  52. longline("\
  53.       z<RETURN>      redraw, current line at top\n\
  54.       z-             ... at bottom\n\
  55.       z.             ... at center\n");
  56.  
  57.     windgoto(0, 52);
  58.     longline(Version);
  59.  
  60.     windgoto(helprow = Rows-2, 47);
  61.     longline("<Press space bar to continue>\n");
  62.     windgoto(helprow = Rows-1, 47);
  63.     longline("<Any other key will quit>");
  64.  
  65.     if ( vgetc() != ' ' )
  66.         return TRUE;
  67.  
  68. /***********************************************************************
  69.  * Second Screen:   Character positioning
  70.  ***********************************************************************/
  71.  
  72.     outcstr(T_ED);
  73.     windgoto(helprow = 0, 0);
  74.  
  75. longline("\
  76.    Character Positioning\n\
  77.    =====================\n\
  78.       ^              first non-white\n\
  79.       0              beginning of line\n\
  80.       $              end of line\n\
  81.       h              backward\n");
  82. longline("\
  83.       l              forward\n\
  84.       ^H             same as h\n\
  85.       space          same as l\n\
  86.       fx             find 'x' forward\n");
  87. longline("\
  88.       Fx             find 'x' backward\n\
  89.       tx             upto 'x' forward\n\
  90.       Tx             upto 'x' backward\n\
  91.       ;              Repeat last f, F, t, or T\n");
  92. longline("\
  93.       ,              inverse of ;\n\
  94.       |              to specified column\n\
  95.       %              find matching (, ), {, }, [, or ]\n");
  96.  
  97.     windgoto(helprow = Rows-2, 47);
  98.     longline("<Press space bar to continue>\n");
  99.     windgoto(helprow = Rows-1, 47);
  100.     longline("<Any other key will quit>");
  101.  
  102.     if ( vgetc() != ' ' )
  103.         return TRUE;
  104.  
  105. /***********************************************************************
  106.  * Third Screen:   Line Positioning, Marking and Returning
  107.  ***********************************************************************/
  108.  
  109.     outcstr(T_ED);
  110.     windgoto(helprow = 0, 0);
  111.  
  112. longline("\
  113.     Line Positioning\n\
  114.     ================\n\
  115.     H           home window line\n\
  116.     L           last window line\n\
  117.     M           middle window line\n");
  118. longline("\
  119.     +           next line, at first non-white\n\
  120.     -           previous line, at first non-white\n\
  121.     CR          return, same as +\n\
  122.     j           next line, same column\n\
  123.     k           previous line, same column\n");
  124.  
  125. longline("\
  126. \n\
  127.     Marking and Returning\n\
  128.     =====================\n\
  129.     ``          previous context\n\
  130.     ''          ... at first non-white in line\n");
  131. longline("\
  132.     mx          mark position with letter 'x'\n\
  133.     `x          to mark 'x'\n\
  134.     'x          ... at first non-white in line\n");
  135.  
  136. longline("\n\
  137.     Undo  &  Redo\n\
  138.     =============\n\
  139.     u           undo last change\n\
  140.     U           restore current line\n\
  141.     .           repeat last change\n");
  142.  
  143.     windgoto(helprow = Rows-2, 47);
  144.     longline("<Press space bar to continue>\n");
  145.     windgoto(helprow = Rows-1, 47);
  146.     longline("<Any other key will quit>");
  147.  
  148.     if ( vgetc() != ' ' )
  149.         return TRUE;
  150. /***********************************************************************
  151.  * Fourth Screen:   Insert & Replace, 
  152.  ***********************************************************************/
  153.  
  154.     outcstr(T_ED);
  155.     windgoto(helprow = 0, 0);
  156.  
  157. longline("\
  158.     Insert and Replace\n\
  159.     ==================\n\
  160.     a           append after cursor\n\
  161.     i           insert before cursor\n\
  162.     A           append at end of line\n\
  163.     I           insert before first non-blank\n");
  164. longline("\
  165.     o           open line below\n\
  166.     O           open line above\n\
  167.     rx          replace single char with 'x'\n\
  168.     R           replace characters\n");
  169.  
  170. longline("\
  171. \n\
  172.     Words, sentences, paragraphs\n\
  173.     ============================\n\
  174.     w           word forward\n\
  175.     b           back word\n\
  176.     e           end of word\n\
  177.     )           to next sentence (not yet)\n\
  178.     }           to next paragraph (not yet)\n");
  179. longline("\
  180.     (           back sentence (not yet)\n\
  181.     {           back paragraph (not yet)\n\
  182.     W           blank delimited word\n\
  183.     B           back W\n\
  184.     E           to end of W\n");
  185.  
  186.     windgoto(helprow = Rows-2, 47);
  187.     longline("<Press space bar to continue>\n");
  188.     windgoto(helprow = Rows-1, 47);
  189.     longline("<Any other key will quit>");
  190.  
  191.     if ( vgetc() != ' ' )
  192.         return TRUE;
  193.  
  194. /***********************************************************************
  195.  * Fifth Screen:   Misc. operations, 
  196.  ***********************************************************************/
  197.  
  198.     outcstr(T_ED);
  199.     windgoto(helprow = 0, 0);
  200.  
  201. longline("\
  202.     Miscellaneous Commands\n\
  203.     ======================\n");
  204. longline("\
  205.     :w          write back changes\n\
  206.     :wq         write and quit\n\
  207.     :x          write if modified, and quit\n\
  208.     :q          quit\n\
  209.     :q!         quit, discard changes\n\
  210.     :e name     edit file 'name'\n");
  211. longline("\
  212.     :e!         reedit, discard changes\n\
  213.     :e #        edit alternate file\n\
  214.     :w name     write file 'name'\n");
  215. longline("\
  216.     :n          edit next file in arglist\n\
  217.     :N          edit prior file in arglist\n\
  218.     :n args     specify new arglist (not yet)\n\
  219.     :rew        rewind arglist\n\
  220.     :f          show current file and lines\n");
  221. longline("\
  222.     :f file     change current file name\n\
  223.     :g/pat/p|d  global command (print or delete only)\n\
  224.     :s/p1/p2/   text substitution (trailing 'g' optional)\n\
  225. ");
  226. longline("\
  227.     :ta tag     to tag file entry 'tag'\n\
  228.     ^]          :ta, current word is tag\n\
  229.     :sh         run an interactive shell\n\
  230.     :!cmd       execute a shell command\n\
  231. ");
  232.  
  233.     windgoto(helprow = Rows-2, 47);
  234.     longline("<Press space bar to continue>\n");
  235.     windgoto(helprow = Rows-1, 47);
  236.     longline("<Any other key will quit>");
  237.  
  238.     if ( vgetc() != ' ' )
  239.         return TRUE;
  240.  
  241. /***********************************************************************
  242.  * Sixth Screen:   Operators, Misc. operations, Yank & Put
  243.  ***********************************************************************/
  244.  
  245.     outcstr(T_ED);
  246.     windgoto(helprow = 0, 0);
  247.  
  248. longline("\
  249.     Operators (double to affect lines)\n\
  250.     ==================================\n\
  251.     d           delete\n\
  252.     c           change\n");
  253. longline("\
  254.     <           left shift\n\
  255.     >           right shift\n\
  256.     y           yank to buffer\n\
  257.     !           filter lines\n");
  258.  
  259. longline("\n\
  260.     Miscellaneous operations\n\
  261.     ========================\n\
  262.     C           change rest of line\n\
  263.     D           delete rest of line\n\
  264.     s           substitute chars\n");
  265. longline("\
  266.     S           substitute lines (not yet)\n\
  267.     J           join lines\n\
  268.     x           delete characters\n\
  269.     X           ... before cursor\n");
  270.  
  271. longline("\n\
  272.     Yank and Put\n\
  273.     ============\n\
  274.     p           put back text\n\
  275.     P           put before\n\
  276.     Y           yank lines");
  277.  
  278.     windgoto(helprow = Rows-1, 47);
  279.     longline("<Press any key>");
  280.  
  281.     (void) vgetc();
  282.  
  283.     return TRUE;
  284. }
  285.  
  286. static void
  287. longline(p)
  288. char    *p;
  289. {
  290.     register char    *s;
  291.  
  292.     for ( s = p; *s ;s++ ) {
  293.         if ( *s == '\n' )
  294.             windgoto(++helprow, 0);
  295.         else
  296.             outchar(*s);
  297.     }
  298. }
  299. #else
  300.  
  301. bool_t
  302. help()
  303. {
  304.     msg("Sorry, help not configured");
  305.     return FALSE;
  306. }
  307. #endif
  308.