diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2022-12-18 22:11:14 +0100 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2023-03-25 18:12:38 +0000 |
commit | 19e2a0d6af3783e572a80e4cbf0f471f6dbf66e7 (patch) | |
tree | 5c3da9666fc651789403f4744347cbcc198b3684 | |
parent | 5da4ef25c8a2e57325bc1706c07f54cc99ce0ce1 (diff) | |
download | riscv-openocd-19e2a0d6af3783e572a80e4cbf0f471f6dbf66e7.zip riscv-openocd-19e2a0d6af3783e572a80e4cbf0f471f6dbf66e7.tar.gz riscv-openocd-19e2a0d6af3783e572a80e4cbf0f471f6dbf66e7.tar.bz2 |
jtag: rewrite command 'adapter name' as COMMAND_HANDLER
Trivial change.
Add the mandatory 'usage' field.
Change-Id: Id92af5cd873fb86f5de79f785f156d1ef734b005
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7493
Tested-by: jenkins
-rw-r--r-- | src/jtag/adapter.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c index eb73fcb..76a6620 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", |