summaryrefslogtreecommitdiff
path: root/src/helper/command.c
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-22 01:48:55 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-24 21:37:30 -0800
commit769fbfa058946e1581d5f9ad75d17947d1ee9ff1 (patch)
treeb645748b64d64ae5fcc26ffb70474dbbbaf0971f /src/helper/command.c
parent4c54c27da774f8035a04f3b091fcfc5661253a0e (diff)
downloadopenocd+libswd-769fbfa058946e1581d5f9ad75d17947d1ee9ff1.tar.gz
openocd+libswd-769fbfa058946e1581d5f9ad75d17947d1ee9ff1.tar.bz2
openocd+libswd-769fbfa058946e1581d5f9ad75d17947d1ee9ff1.tar.xz
openocd+libswd-769fbfa058946e1581d5f9ad75d17947d1ee9ff1.zip
add public API for locating commands
Allow other modules to find a command, primarily for the purpose of registering and unregistering subcommands.
Diffstat (limited to 'src/helper/command.c')
-rw-r--r--src/helper/command.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/helper/command.c b/src/helper/command.c
index af481cd4..54bfb964 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -193,6 +193,16 @@ static struct command *command_find(struct command *head, const char *name)
}
return NULL;
}
+struct command *command_find_in_context(struct command_context *cmd_ctx,
+ const char *name)
+{
+ return command_find(cmd_ctx->commands, name);
+}
+struct command *command_find_in_parent(struct command *parent,
+ const char *name)
+{
+ return command_find(parent->children, name);
+}
/**
* Add the command into the linked list, sorted by name.