home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1557 / help.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-28  |  5.7 KB  |  181 lines

  1.  
  2. /*
  3.  * Copyright (C) 1990 by Jay Konigsberg. mail: jak@sactoh0
  4.  *
  5.  * Permission to use, copy, modify, and distribute this  software  and  its
  6.  * documentation is hereby  granted,  provided  that  the  above  copyright
  7.  * notice appear in all copies  and that  both  the  copyright  notice  and
  8.  * this permission notice appear in supporting documentation. This software
  9.  * is provided "as is" without express or implied  warranty.  However,  the
  10.  * author retains all Copyright priviliges and rights  to  renumeration  if
  11.  * this software is sold.
  12.  */
  13.  
  14. /*
  15.  * help - on-line help information.
  16.  */
  17.  
  18. /* global to replace \b in input */
  19. extern unsigned char bs_char;
  20.  
  21. #include "simped.h"
  22. #define MARKER "--------------------------------------------------------"
  23.  
  24. void help()
  25. {
  26. int    puts(),
  27.     fputs(),
  28.     fflush();
  29.  
  30. int    inpchar,
  31.     getcr;        /* get a return to go */
  32.  
  33. puts("");
  34. puts("Help - S)ave");
  35. puts("       A)bort");
  36. puts("       L)ist");
  37. puts("       E)dit");
  38. puts("       I)nsert");
  39. puts("       D)elete");
  40. puts("       C)ontinue");
  41. puts("       M)odify");
  42. puts("");
  43. fputs ("Enter the command you want help with? ", stdout);
  44. for(;;)
  45.     {
  46.     inpchar=getchar();
  47.     putchar(inpchar);
  48.     if ( (getcr=getchar()) == '\n')
  49.     {
  50.     putchar(getcr);
  51.     break;
  52.     }
  53.     else
  54.     if (getcr == bs_char)
  55.         fputs("\b \b", stdout);
  56.     }
  57. puts(MARKER);
  58. switch(inpchar)
  59.     {
  60.     case 'S':
  61.     case 's':
  62.     puts("\n* S)ave and quit\n");
  63.     puts("Saves the file and quits the editor.\n");
  64.     puts("No options.");
  65.     break;
  66.     case 'A':
  67.     case 'a':
  68.     puts("\n* A)bort/cancel\n");
  69.     puts("Verifies that no save is to be done and then abandons any");
  70.     puts("editing that was done.\n");
  71.     puts("No options.");
  72.     break;
  73.     case 'L':
  74.     case 'l':
  75.     puts("\n* List text\n");
  76.     puts("Lists the text entered, pausing every half page or so. The");
  77.     puts("number of lines listed is set at compile time.\n");
  78.     puts("Options: A starting line number may be entered. A return");
  79.     puts("         will start listing at line 1.");
  80.     break;
  81.     case 'E':
  82.     case 'e':
  83.     puts("\n* Edit line\n");
  84.     puts("Substitute old text for new text on a line.\n");
  85.     puts("Example 1:\n");
  86.     puts("Command? e <RETURN>");
  87.     puts("Line number: 1 <RETURN>\n");
  88.     puts("  1> A line of text\n");
  89.     puts("Old text: f t <RETURN>");
  90.     puts("New text: f modified t <RETURN>\n");
  91.     puts("  1> A line of modified text\n");
  92.     puts("(returns to the command prompt)\n\n");
  93.     fputs("Touch any key to continue: ", stdout);
  94.     fflush(stdout);
  95.     inpchar=getchar();
  96.     puts("\n\nExample 2:\n");
  97.     puts("Command? e1/f t/f modified t/\n");
  98.     puts("  1> A line of modified text\n");
  99.     puts("(returns to the command prompt)\n");
  100.     puts("To insert characters at the beginning of a line, enter");
  101.     puts("nothing for the \"Old text:\" and the characters to be");
  102.     puts("inserted for the \"New text:\".\n");
  103.     puts("To delete characters, enter them in the \"Old text:\" and");
  104.     puts("nothing in the new text.\n");
  105.     puts("Entering nothing in both \"Old text:\" and \"New text:\" will");
  106.     puts("result in no change.");
  107.     break;
  108.     case 'I':
  109.     case 'i':
  110.     puts("\n* Insert line\n");
  111.     puts("Insert lines of text BEFORE the line number specified. The");
  112.     puts("user is dropped into 'insert mode'.\n");
  113.     puts("Option: The line number you want the inserted text to");
  114.     puts("        appear BEFORE.");
  115.     break;
  116.     case 'D':
  117.     case 'd':
  118.     puts("\n* Delete line\n");
  119.     puts("Delete a line. The line will be printed and you must enter");
  120.     puts("a 'y' for the line to be deleted.\n");
  121.     puts("Option: The line number you want deleted.");
  122.     break;
  123.     case 'C':
  124.     case 'c':
  125.     puts("\n* Continue\n");
  126.     puts("Continue entry. Drops the user into input mode AFTER the");
  127.     puts("last line in the file.\n");
  128.     puts("No options.");
  129.     break;
  130.     case 'M':
  131.     case 'm':
  132.     puts("\n* Modify\n");
  133.     puts("This is a multi-use editing function added in a effort");
  134.     puts("to regain some of the flexibility lost in making this");
  135.     puts("editor simple.\n");
  136.     puts("Option: The line number you want to modify.\n");
  137.     puts("This command can:\n");
  138.     puts("  - replace text");
  139.     puts("  - put blanks in place of characters");
  140.     puts("  - delete text");
  141.     puts("  - insert text\n");
  142.     puts("The line is printed and and the cursor is placed under the");
  143.     puts("first character on the next line. Changes are made by placing");
  144.     puts("one or more of the available options below the portion of");
  145.     puts("the line.\n");
  146.     fputs("Touch any key to continue: ", stdout);
  147.     fflush(stdout);
  148.     inpchar=getchar();
  149.     puts("\n\nOPTION              EXPLANATION");
  150.     puts("------              -----------");
  151.     puts("^text#              Inserts the characters between the '^'");
  152.     puts("                    and the '#' BEFORE the character");
  153.     puts("                    pointed to by the '^'. Inside the '^'");
  154.     puts("                    and the '#', both the '&' and the '^'");
  155.     puts("                    are treated as regular characters.\n");
  156.     puts("  ^#                Inserts a # before ^ (special case)\n");
  157.     puts("   #                (When not the first character after a");
  158.     puts("                    '^') causes the character above it to");
  159.     puts("                    be deleted and the space closed.\n");
  160.     puts("   &                Replaces the character above it with a");
  161.     puts("                    blank space.\n");
  162.     puts("(space)             No effect.\n");
  163.     puts("ANY OTHER CHARACTER WILL REPLACE THE CHARACTER ABOVE IT!");
  164.     puts("========================================================\n");
  165.     fputs("Touch any key to continue: ", stdout);
  166.     fflush(stdout);
  167.     inpchar=getchar();
  168.     puts("\n\nExample:\n");
  169.     puts("Command? m1 <RETURN>\n");
  170.     puts("   1> Thos sentence isstoobbe mortifd");
  171.     puts("edit>   i  ^is the ####  #&     d   ^ie#\n");
  172.     puts("   1> This is the sentence to be modified\n");
  173.     puts("Command? _");
  174.     break;
  175.     default :
  176.     puts("\nNo such command");
  177.     break;
  178.     }
  179. puts(MARKER);
  180. }
  181.