diff options
Diffstat (limited to 'shell.h')
-rw-r--r-- | shell.h | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Richard Braun. + * Copyright (c) 2015-2018 Richard Braun. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -31,6 +31,20 @@ #include <stddef.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__); \ + } \ +MACRO_END + typedef void (*shell_fn_t)(int argc, char *argv[]); struct shell_cmd { |