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.
This commit is contained in:
Bruce Hill 2019-10-02 13:14:28 -07:00
parent f0016a2d10
commit e25eaf9b92

11
bb.c
View File

@ -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;
}