home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1780 / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-28  |  907 b   |  53 lines

  1. #include <stdio.h>
  2. extern char *edline();
  3. extern void edcommands();
  4.  
  5. main()
  6. {
  7. char *str;
  8.     for(;;)
  9.     {
  10.         str = edline("prompt:  ");
  11.         if( ! strcmp(str, "quit") || (str == (char *)NULL) )
  12.             break;
  13.         else if( ! strcmp(str, "help") )
  14.             edcommands();
  15.         else
  16.             printf("str: '%s'\n",str);
  17.     }
  18.     return 0;
  19. }
  20.  
  21. void edcommands()
  22. {
  23. static char *strs[] = {
  24. "",
  25. "ACCEPT LINE \t\t \t<return>",
  26. "APPEND \t\t\t\ta",
  27. "DELETE A CHAR  \t\t \tx",
  28. "REPLACE A CHAR  \t\tr",
  29. "END INSERT/APPEND MODE \t\tESC",
  30. "ERASE LINE AND START AGAIN \tBREAK(break key)",
  31. "INSERT \t\t  \t\ti",
  32. "MOVE BACKWARD A WORD \t\tb",
  33. "MOVE DOWN A LINE \t\tj",
  34. "MOVE FORWARD A WORD \t\tw",
  35. "MOVE LEFT A CHAR \t\th",
  36. "MOVE RIGHT A CHAR \t\tl",
  37. "MOVE TO BEGINNING OF LINE\t0",
  38. "MOVE TO END OF LINE \t\t$",
  39. "MOVE UP A LINE \t\t\tk",
  40. "",
  41. "LEAVE EDITOR \t\t\tquit",
  42. "",
  43. (char *)NULL
  44. };
  45.  
  46. int i;
  47.  
  48.     for(i=0;strs[i]!=(char *)NULL;i++)
  49.         puts(strs[i]);
  50.  
  51.     return;
  52. }
  53.