home *** CD-ROM | disk | FTP | other *** search
- #ifndef _cmdparse_h
- #define _cmdparse_h
-
- #include "vterm.h"
-
- /* Command Parse completion codes
- */
- #define CMD_OK 0 /* Command accepted, and executed */
- #define CMD_FAIL 1 /* Generical command fail during exec code */
- #define CMD_HELP 2 /* Help requested about command */
- #define CMD_SYNTAX 3 /* Syntax report needed */
- #define CMD_UNKNOWN 4 /* Unknown commond */
- #define CMD_PARSEERR 5 /* Missing quote, bad escape sequence etc */
-
- typedef int (*cmd_proc)(int /*argc */, char** /* *argv[] */);
-
- typedef struct cmdtab_str* cmdtab;
-
- typedef struct cmdtab_str {
- char *command; /* Command name */
- cmd_proc proc; /* Execution function */
- int minargs; /* Min number acceptable args */
- char *syntax; /* Standard syntax message */
- char *fail; /* Generic fail message */
- } cmdtab_str;
-
- /* Examine a strings for flags. The presence of flags
- is indicated by the 1st char being a '-'.
-
- If it is a flags string, for each character in the flags
- string, set a or clear a bit in the flag word according
- the the position of the char in the flags list string.
- Prefixing any flag with '!' or '~' clears the flag.
- */
- unsigned int command_flags(unsigned int opts, char *flags, char *flist);
-
- /* Takes a command, tokenises it and passes it to command_parse */
- int command_parse(cmdtab table, char *cmd, vterm vt);
-
- /* Look up command in command list and execute it, or give help etc */
- int command_process(cmdtab table, int argc, char* argv[], vterm vt);
-
- /*
- * Split a string into tokens, or count tokens
- * Warning: this butchers line
- */
- int command_tokenise(char *line, char *argv[]);
-
- #endif
-