From 22a81ad7ed9e77c87805d544096f70d59e95c38c Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Mon, 25 Aug 2014 13:30:10 +0930 Subject: [PATCH] Add missing header file --- commandline.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 commandline.h diff --git a/commandline.h b/commandline.h new file mode 100644 index 00000000..2f47783b --- /dev/null +++ b/commandline.h @@ -0,0 +1,26 @@ +#ifndef __SERVAL_DNA__COMMANDLINE_H +#define __SERVAL_DNA__COMMANDLINE_H + +#define KEYRING_PIN_OPTION ,"[--keyring-pin=]" +#define KEYRING_ENTRY_PIN_OPTION ,"[--entry-pin=]" +#define KEYRING_PIN_OPTIONS KEYRING_PIN_OPTION KEYRING_ENTRY_PIN_OPTION "..." + +// macros are weird sometimes .... +#define _APPEND(X,Y) X ## Y +#define _APPEND2(X,Y) _APPEND(X,Y) + +#define DEFINE_CMD(FUNC, FLAGS, HELP, WORD1, ...) \ + static int FUNC(const struct cli_parsed *parsed, struct cli_context *context); \ + struct cli_schema _APPEND2(FUNC, __LINE__) \ + __attribute__((used,aligned(sizeof(void *)),section("commands"))) = {\ + .function = FUNC, \ + .words = {WORD1, ##__VA_ARGS__, NULL}, \ + .flags = FLAGS, \ + .description = HELP\ + } + +extern struct cli_schema __start_commands[]; +extern struct cli_schema __stop_commands[]; + +#define CMD_COUNT (__stop_commands - __start_commands) +#endif \ No newline at end of file