]> git.sur5r.net Git - openocd/commitdiff
Update all server port command to use new helper.
authorZachary T Welch <zw@superlucidity.net>
Sat, 24 Oct 2009 08:12:56 +0000 (01:12 -0700)
committerZachary T Welch <zw@superlucidity.net>
Fri, 6 Nov 2009 02:03:19 +0000 (18:03 -0800)
src/server/gdb_server.c
src/server/tcl_server.c
src/server/telnet_server.c

index adf5c687d016c3a5ebd01451376708301beebc46..3ed2b1fc4c0310b92bf7268e8ef748f5144f0a9b 100644 (file)
@@ -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)
index e5886774dc1344f264e9e8dbad89d8ba05529123..178d86ba8cef9b4cfd45d6cce04241d0cac8b8bf 100644 (file)
@@ -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);
 }
index f26ad9f6717ad555efaecbb3e93ddfc9c4a74241..c9c60bbda4e69723196b0f210a1a4500ff6099a2 100644 (file)
@@ -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)