|
|
|
#pragma once
|
|
|
|
|
|
|
|
struct console;
|
|
|
|
|
|
|
|
struct cmd {
|
|
|
|
const char *cmd;
|
|
|
|
const char *desc;
|
|
|
|
void (* exec)(struct console *con, const char **argv, size_t argc);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct shell {
|
|
|
|
char line[128];
|
|
|
|
struct cmd *cmds;
|
|
|
|
const char *prompt;
|
|
|
|
struct console *con;
|
|
|
|
};
|
|
|
|
|
|
|
|
size_t count_args(const char *line);
|
|
|
|
char **parse_args(const char *line, size_t *argc);
|
|
|
|
|
|
|
|
void cmd_exec(struct cmd *cmds, struct console *con, const char **argv,
|
|
|
|
size_t argc);
|
|
|
|
void cmd_parse(struct cmd *cmds, struct console *con, const char *line);
|
|
|
|
|
|
|
|
int shell_init(struct shell *shell, struct cmd *cmds,
|
|
|
|
struct console *con, const char *prompt);
|
|
|
|
int shell_parse(struct shell *shell);
|
|
|
|
|
|
|
|
void do_flash_cmd(struct console *con, const char **argv, size_t argc);
|
|
|
|
void do_ftl_cmd(struct console *con, const char **argv, size_t argc);
|
|
|
|
void do_mufs_cmd(struct console *con, const char **argv, size_t argc);
|