From: openocd-gerrit <ope...@us...> - 2024-09-21 09:06:06
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via ad216136180e0cd482f414eb072c9dd25dd1c559 (commit) from e6ade35305fa32674d615a26713487b5ad00b352 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ad216136180e0cd482f414eb072c9dd25dd1c559 Author: Marc Schink <de...@za...> 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 <de...@za...> Reviewed-on: https://review.openocd.org/c/openocd/+/8378 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/doc/openocd.texi b/doc/openocd.texi index e8a1f33b5..97396c7b7 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -2227,7 +2227,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 ebfb0562e..cf3eca36e 100644 --- a/src/server/startup.tcl +++ b/src/server/startup.tcl @@ -113,3 +113,9 @@ proc "tcl_trace" {state} { echo "DEPRECATED! use 'tcl trace' not 'tcl_trace'" eval tcl trace $state } + +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 02d450fbd..a596afef0 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 }; ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 2 +- src/server/startup.tcl | 6 ++++++ src/server/telnet_server.c | 24 +++++++++++++++++------- 3 files changed, 24 insertions(+), 8 deletions(-) hooks/post-receive -- Main OpenOCD repository |