This is an automated email from Gerrit.

"zapb <d...@zapb.de>" just uploaded a new patch set to Gerrit, which you can 
find at https://review.openocd.org/c/openocd/+/8378

-- gerrit

commit d54cc7e02f0c17298d0b747ba4d040495e400e11
Author: Marc Schink <d...@zapb.de>
Date:   Mon Jun 24 16:26:02 2024 +0200

    server/telnet: Restructure commands
    
    Use a command group 'telnet' with subcommands instead of individual
    commands with 'telnet_' prefix. Even though there is only one subcommand
    at the moment, make this change to ensure consistency with other commands.
    
    The old command is still available to ensure backwards compatibility,
    but are marked as deprecated.
    
    Change-Id: I5e88632fa0d0ce5a8129e9fcf5ae743fc5b093cb
    Signed-off-by: Marc Schink <d...@zapb.de>

diff --git a/doc/openocd.texi b/doc/openocd.texi
index 3d5e213c4b..f823b65851 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2229,7 +2229,7 @@ the port @var{number} defaults to 6666.
 When specified as "disabled", this service is not activated.
 @end deffn
 
-@deffn {Config Command} {telnet_port} [number]
+@deffn {Config Command} {telnet port} [number]
 Specify or query the
 port on which to listen for incoming telnet connections.
 This port is intended for interaction with one human through TCL commands.
diff --git a/src/server/startup.tcl b/src/server/startup.tcl
index 93f718927d..33f706109c 100644
--- a/src/server/startup.tcl
+++ b/src/server/startup.tcl
@@ -95,3 +95,9 @@ proc "gdb_save_tdesc" {} {
        echo "DEPRECATED! use 'gdb save_tdesc', not 'gdb_save_tdesc'"
        eval gdb save_tdesc
 }
+
+lappend _telnet_autocomplete_skip "telnet_port"
+proc "telnet_port" {args} {
+       echo "DEPRECATED! use 'telnet port', not 'telnet_port'"
+       eval telnet port $args
+}
diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c
index 72171cb3f5..0f10aa65fe 100644
--- a/src/server/telnet_server.c
+++ b/src/server/telnet_server.c
@@ -967,7 +967,6 @@ int telnet_init(char *banner)
        return ERROR_OK;
 }
 
-/* daemon configuration command telnet_port */
 COMMAND_HANDLER(handle_telnet_port_command)
 {
        return CALL_COMMAND_HANDLER(server_pipe_command, &telnet_port);
@@ -978,6 +977,19 @@ COMMAND_HANDLER(handle_exit_command)
        return ERROR_COMMAND_CLOSE_CONNECTION;
 }
 
+static const struct command_registration telnet_subcommand_handlers[] = {
+       {
+               .name = "port",
+               .handler = handle_telnet_port_command,
+               .mode = COMMAND_CONFIG,
+               .help = "Specify port on which to listen "
+                       "for incoming telnet connections.  "
+                       "Read help on 'gdb port'.",
+               .usage = "[port_num]",
+       },
+       COMMAND_REGISTRATION_DONE
+};
+
 static const struct command_registration telnet_command_handlers[] = {
        {
                .name = "exit",
@@ -987,13 +999,11 @@ static const struct command_registration 
telnet_command_handlers[] = {
                .help = "exit telnet session",
        },
        {
-               .name = "telnet_port",
-               .handler = handle_telnet_port_command,
+               .name = "telnet",
+               .chain = telnet_subcommand_handlers,
                .mode = COMMAND_CONFIG,
-               .help = "Specify port on which to listen "
-                       "for incoming telnet connections.  "
-                       "Read help on 'gdb port'.",
-               .usage = "[port_num]",
+               .help = "telnet commands",
+               .usage = "",
        },
        COMMAND_REGISTRATION_DONE
 };

-- 

Reply via email to