diff options
author | Richard Braun <rbraun@sceen.net> | 2018-01-04 21:43:37 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2018-01-04 21:43:37 +0100 |
commit | e7321910ca4d956b572a050d302a25df37ce06ab (patch) | |
tree | a3428d4746741325218dd385f36f84b494058d91 /shell.h | |
parent | fe5415c54b05853dbbe230fca0aea3623c3be1e2 (diff) |
error: remove and use errno.h directly
Diffstat (limited to 'shell.h')
-rw-r--r-- | shell.h | 26 |
1 files changed, 16 insertions, 10 deletions
@@ -30,19 +30,25 @@ #define _SHELL_H #include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> -#include <error.h> #include <macros.h> -#define SHELL_REGISTER_CMDS(cmds) \ -MACRO_BEGIN \ - size_t ___i; \ - int ___error; \ - \ - for (___i = 0; ___i < ARRAY_SIZE(cmds); ___i++) { \ - ___error = shell_cmd_register(&(cmds)[___i]); \ - error_check(___error, __func__); \ - } \ +#define SHELL_REGISTER_CMDS(cmds) \ +MACRO_BEGIN \ + size_t ___i; \ + int ___error; \ + \ + for (___i = 0; ___i < ARRAY_SIZE(cmds); ___i++) { \ + ___error = shell_cmd_register(&(cmds)[___i]); \ + \ + if (___error) { \ + fprintf(stderr, "%s: %s\n", __func__, strerror(___error)); \ + abort(); \ + } \ + } \ MACRO_END typedef void (*shell_fn_t)(int argc, char *argv[]); |