From e25eaf9b92b62027ede8a8b142dadfb8d95c227a Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 2 Oct 2019 13:14:28 -0700 Subject: [PATCH] Default behavior for invalid bb commands is now to print an error message to stdout on the default console screen and otherwise ignore it instead of exiting. --- bb.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bb.c b/bb.c index 2c9fa32..8f5414d 100644 --- a/bb.c +++ b/bb.c @@ -815,7 +815,16 @@ bb_result_t process_cmd(bb_t *bb, const char *cmd) if (e) set_selected(bb, e, !IS_SELECTED(e)); return BB_OK; } - default: err("UNKNOWN COMMAND: '%s'", cmd); break; + default: { + fputs(T_LEAVE_BBMODE, tty_out); + restore_term(&orig_termios); + const char *msg = "Invalid bb command: "; + write(STDERR_FILENO, msg, strlen(msg)); + write(STDERR_FILENO, cmd, strlen(cmd)); + write(STDERR_FILENO, "\n", 1); + init_term(); + return BB_INVALID; + } } return BB_INVALID; }