summaryrefslogtreecommitdiff
path: root/src/helper/command.h
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-10 19:00:01 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-13 10:51:45 -0800
commitddb6138ed428f666064d26bb08036de3afe44bc8 (patch)
treee127983a43d444b4893fc549ea6cb150465448e6 /src/helper/command.h
parent3f9fd4e2a6ab7b3ce3819c385c34cf6f4630763c (diff)
downloadopenocd+libswd-ddb6138ed428f666064d26bb08036de3afe44bc8.tar.gz
openocd+libswd-ddb6138ed428f666064d26bb08036de3afe44bc8.tar.bz2
openocd+libswd-ddb6138ed428f666064d26bb08036de3afe44bc8.tar.xz
openocd+libswd-ddb6138ed428f666064d26bb08036de3afe44bc8.zip
add command_handler_t type
This patch adds new typedefs for command handler callback functions. Users of this type signature were updated to use these new types. It uses the new __COMMAND_HANDLER macro to prevent duplication.
Diffstat (limited to 'src/helper/command.h')
-rw-r--r--src/helper/command.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/helper/command.h b/src/helper/command.h
index 236dabbe..aec066d0 100644
--- a/src/helper/command.h
+++ b/src/helper/command.h
@@ -122,12 +122,15 @@ typedef struct command_context_s
#define COMMAND_HELPER(name, extra...) __COMMAND_HANDLER(name, extra)
+/// The type signature for commands' handler functions.
+typedef __COMMAND_HANDLER((*command_handler_t));
+
typedef struct command_s
{
char *name;
struct command_s *parent;
struct command_s *children;
- int (*handler)(struct command_context_s *context, char* name, char** args, int argc);
+ command_handler_t handler;
enum command_mode mode;
struct command_s *next;
} command_t;
@@ -143,9 +146,7 @@ typedef struct command_s
char *command_name(struct command_s *c, char delim);
command_t* register_command(command_context_t *context,
- command_t *parent, char *name,
- int (*handler)(struct command_context_s *context,
- char* name, char** args, int argc),
+ command_t *parent, char *name, command_handler_t handler,
enum command_mode mode, char *help);
int unregister_command(command_context_t *context, char *name);