summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-10 03:12:21 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-13 10:51:45 -0800
commit63a26b421b1731df5826a157ea633b9d2c02aaee (patch)
tree08697690015b3f09bf22b10fcd10599af15a4041 /src/server
parentcfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e (diff)
downloadopenocd+libswd-63a26b421b1731df5826a157ea633b9d2c02aaee.tar.gz
openocd+libswd-63a26b421b1731df5826a157ea633b9d2c02aaee.tar.bz2
openocd+libswd-63a26b421b1731df5826a157ea633b9d2c02aaee.tar.xz
openocd+libswd-63a26b421b1731df5826a157ea633b9d2c02aaee.zip
use COMMAND_HELPER for command helper functions
Define the numerous helpers that inherit command handler parameters using the COMMAND_HELPER macro.
Diffstat (limited to 'src/server')
-rw-r--r--src/server/server.c3
-rw-r--r--src/server/server.h12
2 files changed, 11 insertions, 4 deletions
diff --git a/src/server/server.c b/src/server/server.c
index c000b7c2..ada0a602 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -551,8 +551,7 @@ int server_register_commands(command_context_t *context)
}
-int server_port_command(struct command_context_s *cmd_ctx,
- char *cmd, char **args, int argc, unsigned short *out)
+SERVER_PORT_COMMAND()
{
switch (argc) {
case 0:
diff --git a/src/server/server.h b/src/server/server.h
index d4f1b6b5..abb501d4 100644
--- a/src/server/server.h
+++ b/src/server/server.h
@@ -81,8 +81,16 @@ int server_loop(command_context_t *command_context);
int server_register_commands(command_context_t *context);
-int server_port_command(struct command_context_s *cmd_ctx,
- char *cmd, char **args, int argc, unsigned short *port);
+/**
+ * Defines an extended command handler function declaration to enable
+ * access to (and manipulation of) the server port number.
+ * Call server_port like a normal COMMAND_HANDLER with an extra @a out parameter
+ * to receive the specified port number.
+ */
+#define SERVER_PORT_COMMAND() \
+ COMMAND_HELPER(server_port_command, unsigned short *out)
+
+SERVER_PORT_COMMAND();
extern int server_use_pipes;