Skip to content

Commit ad21613

Browse files
zapb-0borneoa
authored andcommitted
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 <[email protected]> Reviewed-on: https://review.openocd.org/c/openocd/+/8378 Tested-by: jenkins Reviewed-by: Antonio Borneo <[email protected]>
1 parent e6ade35 commit ad21613

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

doc/openocd.texi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2227,7 +2227,7 @@ the port @var{number} defaults to 6666.
22272227
When specified as "disabled", this service is not activated.
22282228
@end deffn
22292229

2230-
@deffn {Config Command} {telnet_port} [number]
2230+
@deffn {Config Command} {telnet port} [number]
22312231
Specify or query the
22322232
port on which to listen for incoming telnet connections.
22332233
This port is intended for interaction with one human through TCL commands.

src/server/startup.tcl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,9 @@ proc "tcl_trace" {state} {
113113
echo "DEPRECATED! use 'tcl trace' not 'tcl_trace'"
114114
eval tcl trace $state
115115
}
116+
117+
lappend _telnet_autocomplete_skip "telnet_port"
118+
proc "telnet_port" {args} {
119+
echo "DEPRECATED! use 'telnet port', not 'telnet_port'"
120+
eval telnet port $args
121+
}

src/server/telnet_server.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,6 @@ int telnet_init(char *banner)
967967
return ERROR_OK;
968968
}
969969

970-
/* daemon configuration command telnet_port */
971970
COMMAND_HANDLER(handle_telnet_port_command)
972971
{
973972
return CALL_COMMAND_HANDLER(server_pipe_command, &telnet_port);
@@ -978,6 +977,19 @@ COMMAND_HANDLER(handle_exit_command)
978977
return ERROR_COMMAND_CLOSE_CONNECTION;
979978
}
980979

980+
static const struct command_registration telnet_subcommand_handlers[] = {
981+
{
982+
.name = "port",
983+
.handler = handle_telnet_port_command,
984+
.mode = COMMAND_CONFIG,
985+
.help = "Specify port on which to listen "
986+
"for incoming telnet connections. "
987+
"Read help on 'gdb port'.",
988+
.usage = "[port_num]",
989+
},
990+
COMMAND_REGISTRATION_DONE
991+
};
992+
981993
static const struct command_registration telnet_command_handlers[] = {
982994
{
983995
.name = "exit",
@@ -987,13 +999,11 @@ static const struct command_registration telnet_command_handlers[] = {
987999
.help = "exit telnet session",
9881000
},
9891001
{
990-
.name = "telnet_port",
991-
.handler = handle_telnet_port_command,
1002+
.name = "telnet",
1003+
.chain = telnet_subcommand_handlers,
9921004
.mode = COMMAND_CONFIG,
993-
.help = "Specify port on which to listen "
994-
"for incoming telnet connections. "
995-
"Read help on 'gdb port'.",
996-
.usage = "[port_num]",
1005+
.help = "telnet commands",
1006+
.usage = "",
9971007
},
9981008
COMMAND_REGISTRATION_DONE
9991009
};

0 commit comments

Comments
 (0)