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 <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8378
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Marc Schink 2024-06-24 16:26:02 +02:00 committed by Antonio Borneo
parent e6ade35305
commit ad21613618
3 changed files with 24 additions and 8 deletions

View File

@ -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.

View File

@ -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
}

View File

@ -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
};