From 19e2a0d6af3783e572a80e4cbf0f471f6dbf66e7 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 18 Dec 2022 22:11:14 +0100 Subject: [PATCH] jtag: rewrite command 'adapter name' as COMMAND_HANDLER Trivial change. Add the mandatory 'usage' field. Change-Id: Id92af5cd873fb86f5de79f785f156d1ef734b005 Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/7493 Tested-by: jenkins --- src/jtag/adapter.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c index eb73fcb9a..76a6620be 100644 --- a/src/jtag/adapter.c +++ b/src/jtag/adapter.c @@ -378,21 +378,18 @@ done: return equal; } -static int jim_adapter_name(Jim_Interp *interp, int argc, Jim_Obj * const *argv) +COMMAND_HANDLER(handle_adapter_name) { - struct jim_getopt_info goi; - jim_getopt_setup(&goi, interp, argc-1, argv + 1); - /* return the name of the interface */ /* TCL code might need to know the exact type... */ /* FUTURE: we allow this as a means to "set" the interface. */ - if (goi.argc != 0) { - Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)"); - return JIM_ERR; - } - const char *name = adapter_driver ? adapter_driver->name : NULL; - Jim_SetResultString(goi.interp, name ? name : "undefined", -1); - return JIM_OK; + + if (CMD_ARGC != 0) + return ERROR_COMMAND_SYNTAX_ERROR; + + command_print(CMD, "%s", adapter_driver ? adapter_driver->name : "undefined"); + + return ERROR_OK; } COMMAND_HANDLER(adapter_transports_command) @@ -1127,9 +1124,10 @@ static const struct command_registration adapter_command_handlers[] = { { .name = "name", .mode = COMMAND_ANY, - .jim_handler = jim_adapter_name, + .handler = handle_adapter_name, .help = "Returns the name of the currently " "selected adapter (driver)", + .usage = "", }, { .name = "srst",