home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- extern char *edline();
- extern void edcommands();
-
- main()
- {
- char *str;
- for(;;)
- {
- str = edline("prompt: ");
- if( ! strcmp(str, "quit") || (str == (char *)NULL) )
- break;
- else if( ! strcmp(str, "help") )
- edcommands();
- else
- printf("str: '%s'\n",str);
- }
- return 0;
- }
-
- void edcommands()
- {
- static char *strs[] = {
- "",
- "ACCEPT LINE \t\t \t<return>",
- "APPEND \t\t\t\ta",
- "DELETE A CHAR \t\t \tx",
- "REPLACE A CHAR \t\tr",
- "END INSERT/APPEND MODE \t\tESC",
- "ERASE LINE AND START AGAIN \tBREAK(break key)",
- "INSERT \t\t \t\ti",
- "MOVE BACKWARD A WORD \t\tb",
- "MOVE DOWN A LINE \t\tj",
- "MOVE FORWARD A WORD \t\tw",
- "MOVE LEFT A CHAR \t\th",
- "MOVE RIGHT A CHAR \t\tl",
- "MOVE TO BEGINNING OF LINE\t0",
- "MOVE TO END OF LINE \t\t$",
- "MOVE UP A LINE \t\t\tk",
- "",
- "LEAVE EDITOR \t\t\tquit",
- "",
- (char *)NULL
- };
-
- int i;
-
- for(i=0;strs[i]!=(char *)NULL;i++)
- puts(strs[i]);
-
- return;
- }
-