From 2b78a4e82b1845ee7cc89f6e31d7b49e9299cb32 Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Sat, 24 Oct 2009 01:12:56 -0700 Subject: [PATCH] Update all server port command to use new helper. --- src/server/gdb_server.c | 10 +--------- src/server/tcl_server.c | 8 +++----- src/server/telnet_server.c | 10 +--------- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index adf5c687d..3ed2b1fc4 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2271,15 +2271,7 @@ int handle_gdb_sync_command(struct command_context_s *cmd_ctx, char *cmd, char * /* daemon configuration command gdb_port */ int handle_gdb_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - if (argc == 0) - { - command_print(cmd_ctx, "%d", gdb_port); - return ERROR_OK; - } - - gdb_port = strtoul(args[0], NULL, 0); - - return ERROR_OK; + return server_port_command(cmd_ctx, cmd, args, argc, &gdb_port); } int handle_gdb_memory_map_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) diff --git a/src/server/tcl_server.c b/src/server/tcl_server.c index e5886774d..178d86ba8 100644 --- a/src/server/tcl_server.c +++ b/src/server/tcl_server.c @@ -179,10 +179,8 @@ int tcl_register_commands(command_context_t *cmd_ctx) return ERROR_OK; } -static int handle_tcl_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_tcl_port_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { - if (argc == 1) { - tcl_port = strtoul(args[0], NULL, 0); - } - return ERROR_OK; + return server_port_command(cmd_ctx, cmd, args, argc, &tcl_port); } diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index f26ad9f67..c9c60bbda 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -622,15 +622,7 @@ int telnet_register_commands(command_context_t *command_context) /* daemon configuration command telnet_port */ int handle_telnet_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - if (argc == 0) - { - command_print(cmd_ctx, "%d", telnet_port); - return ERROR_OK; - } - - telnet_port = strtoul(args[0], NULL, 0); - - return ERROR_OK; + return server_port_command(cmd_ctx, cmd, args, argc, &telnet_port); } int handle_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)