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

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