diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-10-13 19:34:16 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-10-13 19:34:16 -0700 |
| commit | 55daca6a2f6e4401ae50523aad082f2c0785222b (patch) | |
| tree | 3c087c64523a32723a5d99d995f753ae010a2e70 /bb.h | |
| parent | d77907783fe0f0303967813f7fa85369502db1d5 (diff) | |
More code cleanup, including tweaking matches_cmd() to figure out if
there are required arguments or not, and refactoring run_bbcmd() to no
longer return a value (which was ignored), but instead just spit out error messages to
stderr if necessary.
Diffstat (limited to 'bb.h')
| -rw-r--r-- | bb.h | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -61,6 +61,14 @@ exit(EXIT_FAILURE); \ } while (0) +#define warn(...) do { \ + fputs(T_LEAVE_BBMODE, tty_out); \ + restore_term(&orig_termios); \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, "\n"); \ + init_term(); \ +} while (0) + // Types: typedef struct { int key; @@ -129,8 +137,6 @@ typedef struct bb_s { unsigned int should_quit : 1; } bb_t; -typedef enum { BB_OK = 0, BB_INVALID } bb_result_t; - // Configurable options: #define SCROLLOFF MIN(5, (termheight-4)/2) #define CMDFILE_FORMAT "/tmp/bb.XXXXXX" @@ -182,7 +188,7 @@ 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 run_bbcmd(bb_t *bb, const char *cmd); +static void 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); |
