|
|
|
@ -38,7 +38,7 @@ int 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) |
|
|
|
|
struct console *con, const char *prompt, unsigned flags) |
|
|
|
|
{ |
|
|
|
|
if (!shell || !con) |
|
|
|
|
return -1; |
|
|
|
@ -47,6 +47,7 @@ int shell_init(struct shell *shell, struct cmd *cmds, |
|
|
|
|
shell->cmds = cmds; |
|
|
|
|
shell->con = con; |
|
|
|
|
shell->prompt = prompt; |
|
|
|
|
shell->flags = flags; |
|
|
|
|
|
|
|
|
|
fprintf(shell->con->fp, "%s ", prompt ? prompt : "#"); |
|
|
|
|
|
|
|
|
@ -64,7 +65,11 @@ int shell_parse(struct shell *shell) |
|
|
|
|
0) |
|
|
|
|
return ret; |
|
|
|
|
|
|
|
|
|
cmd_parse(shell->cmds, shell->con, shell->line); |
|
|
|
|
ret = cmd_parse(shell->cmds, shell->con, shell->line); |
|
|
|
|
|
|
|
|
|
if (shell->flags & SHELL_SHOW_EXIT_CODE) |
|
|
|
|
fprintf(shell->con->fp, "\004%d\n\004", ret); |
|
|
|
|
|
|
|
|
|
fprintf(shell->con->fp, "%s ", shell->prompt ? shell->prompt : "#"); |
|
|
|
|
*shell->line = '\0'; |
|
|
|
|
|
|
|
|
|