From e40feed849fb24aee23e4a19110e642a77c38726 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 13 Oct 2019 18:33:46 -0700 Subject: Cleaned up the command parsing code a bit to be slightly more correct and more compact. Now uses if-else-if chain instead of nested switch statements. This may be very slightly less performant, but probably not noticeable and much cleaner code. --- bb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bb.h') diff --git a/bb.h b/bb.h index 358016c..ba4d404 100644 --- a/bb.h +++ b/bb.h @@ -178,11 +178,12 @@ static int fputs_escaped(FILE *f, const char *str, const char *color); static void init_term(void); static int is_simple_bbcmd(const char *s); static entry_t* load_entry(bb_t *bb, const char *path, int clear_dots); +static inline int matches_cmd(const char *str, const char *cmd); static void* memcheck(void *p); static void normalize_path(const char *root, const char *path, char *pbuf, int clear_dots); static void populate_files(bb_t *bb, int samedir); static void print_bindings(int fd); -static bb_result_t process_cmd(bb_t *bb, const char *cmd); +static bb_result_t run_bbcmd(bb_t *bb, const char *cmd); static void render(bb_t *bb); static void restore_term(const struct termios *term); static int run_script(bb_t *bb, const char *cmd); -- cgit v1.2.3