summaryrefslogtreecommitdiff
path: root/shell.h
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-01-04 21:43:37 +0100
committerRichard Braun <rbraun@sceen.net>2018-01-04 21:43:37 +0100
commite7321910ca4d956b572a050d302a25df37ce06ab (patch)
treea3428d4746741325218dd385f36f84b494058d91 /shell.h
parentfe5415c54b05853dbbe230fca0aea3623c3be1e2 (diff)
error: remove and use errno.h directly
Diffstat (limited to 'shell.h')
-rw-r--r--shell.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/shell.h b/shell.h
index f509880..54a3b7a 100644
--- a/shell.h
+++ b/shell.h
@@ -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[]);