From 63a26b421b1731df5826a157ea633b9d2c02aaee Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Tue, 10 Nov 2009 03:12:21 -0800 Subject: use COMMAND_HELPER for command helper functions Define the numerous helpers that inherit command handler parameters using the COMMAND_HELPER macro. --- src/server/server.c | 3 +-- src/server/server.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src/server') 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; -- cgit v1.2.3