From 6da0512092d03bb9ea08df0cafd5d3fbaef432d2 Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Wed, 3 Apr 2019 18:50:41 +0200 Subject: [PATCH] helper/command: remove command "command type" Once the wrapper "ocd_bouncer" is removed (which was the only user of this command), there is no reason to keep the command any longer. Remove it. This change was part of http://openocd.zylin.com/1815 from Paul Fertser and has been extracted and rebased to simplify the review. Change-Id: I979ce1c147babedb44dd77418751133f589f827c Signed-off-by: Paul Fertser Signed-off-by: Tomas Vanek Signed-off-by: Antonio Borneo Reviewed-on: http://openocd.zylin.com/5084 Tested-by: jenkins --- src/helper/command.c | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/src/helper/command.c b/src/helper/command.c index 4883984f14..98c62cf8cd 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -1065,32 +1065,6 @@ static int jim_command_mode(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return JIM_OK; } -static int jim_command_type(Jim_Interp *interp, int argc, Jim_Obj *const *argv) -{ - if (1 == argc) - return JIM_ERR; - - struct command_context *cmd_ctx = current_command_context(interp); - struct command *c = cmd_ctx->commands; - int remaining = command_unknown_find(argc - 1, argv + 1, c, &c, true); - /* if nothing could be consumed, then it's an unknown command */ - if (remaining == argc - 1) { - Jim_SetResultString(interp, "unknown", -1); - return JIM_OK; - } - - if (c->jim_handler) - Jim_SetResultString(interp, "native", -1); - else if (c->handler) - Jim_SetResultString(interp, "simple", -1); - else if (remaining == 0) - Jim_SetResultString(interp, "group", -1); - else - Jim_SetResultString(interp, "unknown", -1); - - return JIM_OK; -} - int help_add_command(struct command_context *cmd_ctx, struct command *parent, const char *cmd_name, const char *help_text, const char *usage) { @@ -1211,15 +1185,6 @@ static const struct command_registration command_subcommand_handlers[] = { "Returns 'unknown' if an unknown command is given. " "Command can be multiple tokens.", }, - { - .name = "type", - .mode = COMMAND_ANY, - .jim_handler = jim_command_type, - .usage = "command_name [...]", - .help = "Returns the type of built-in command:" - "'native', 'simple', 'group', or 'unknown'. " - "Command can be multiple tokens.", - }, COMMAND_REGISTRATION_DONE }; -- 2.30.2