4 #define HISTORY 100 /* Don't let history grow unbounded */
7 typedef struct parser_cmd {
9 int (* pc_func)(int, char **);
10 struct parser_cmd * pc_sub_cmd;
14 typedef struct argcmd {
16 int (*ac_func)(int, char **);
20 int Parser_quit(int argc, char **argv);
21 void Parser_init(char *, command_t *); /* Set prompt and load command list */
22 void Parser_commands(void); /* Start the command parser */
23 void Parser_qhelp(int, char **); /* Quick help routine */
24 int Parser_help(int, char **); /* Detailed help routine */
25 void Parser_exit(int, char **); /* Shuts down command parser */
26 int Parser_execarg(int argc, char **argv, command_t cmds[]);
27 void execute_line(char * line);
29 /* Converts a string to an integer */
30 int Parser_int(char *, int *);
32 /* Prompts for a string, with default values and a maximum length */
33 char *Parser_getstr(const char *prompt, const char *deft, char *res,
36 /* Prompts for an integer, with minimum, maximum and default values and base */
37 int Parser_getint(const char *prompt, long min, long max, long deft,
40 /* Prompts for a yes/no, with default */
41 int Parser_getbool(const char *prompt, int deft);
43 /* Extracts an integer from a string, or prompts if it cannot get one */
44 long Parser_intarg(const char *inp, const char *prompt, int deft,
45 int min, int max, int base);
47 /* Extracts a word from the input, or propmts if it cannot get one */
48 char *Parser_strarg(char *inp, const char *prompt, const char *deft,
49 char *answer, int len);
51 /* Extracts an integer from a string with a base */
52 int Parser_arg2int(const char *inp, long *result, int base);