7 /* Maximum length for a single command */
8 #define CMD_MAX_LENGTH 2048
9 /* Maximum number of tokens per command */
10 #define CMD_MAX_TOKENS 64
12 /* Add some commands to the queue to be executed */
13 void cmd_enqueue(int insert, char *input);
14 void cmd_enqueuef(int insert, const char *fmt, ...);
15 #define cmd_append(input) cmd_enqueue(0, (input))
16 #define cmd_appendf(...) cmd_enqueuef(0, __VA_ARGS__)
17 #define cmd_insert(input) cmd_enqueue(1, (input))
18 #define cmd_insertf(...) cmd_enqueuef(1, __VA_ARGS__)
20 /* Execute pending commands */
21 int cmd_queue_process(void);
23 /* execute until there are no commands left */
24 void cmd_queue_flush(void);
26 /* Attempt to autocomplete an input string */
27 const char *cmd_complete(char *input);
29 typedef void (*cmd_handler_t)(int argc, char *argv[]);
31 void cmd_addcommand(const char *cmd_name, cmd_handler_t cmd_func, const char *cmd_help_text);