summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorEliel C. Sardanons <eliels@gmail.com>2009-05-18 20:31:29 +0000
committerEliel C. Sardanons <eliels@gmail.com>2009-05-18 20:31:29 +0000
commit311c99789605d7536579226743ea369fd799ad57 (patch)
tree3a996ea5b7b2cde710c327527f341cc6b611c23e /main
parent75cd3f4918f88edf07f0f7f4ddcb79c1acdac54a (diff)
Avoid autocompleting passed the action name argument in the CLI command.
When running the autocomplete of the CLI command 'manager show command <action>' it was autocompleting everything else after the <action> argument, giving an error, because this command doesn't support multiple AMI action names at a time. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@195367 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/manager.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/main/manager.c b/main/manager.c
index b4067e914..aacdf4b7e 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -612,17 +612,22 @@ static char *handle_showmancmd(struct ast_cli_entry *e, int cmd, struct ast_cli_
" Shows the detailed description for a specific Asterisk manager interface command.\n";
return NULL;
case CLI_GENERATE:
- l = strlen(a->word);
- which = 0;
- AST_RWLIST_RDLOCK(&actions);
- AST_RWLIST_TRAVERSE(&actions, cur, list) {
- if (!strncasecmp(a->word, cur->action, l) && ++which > a->n) {
- ret = ast_strdup(cur->action);
- break; /* make sure we exit even if ast_strdup() returns NULL */
+ if (a->pos == 3) {
+ /* autocomplete the action name. */
+ l = strlen(a->word);
+ which = 0;
+ AST_RWLIST_RDLOCK(&actions);
+ AST_RWLIST_TRAVERSE(&actions, cur, list) {
+ if (!strncasecmp(a->word, cur->action, l) && ++which > a->n) {
+ ret = ast_strdup(cur->action);
+ break; /* make sure we exit even if ast_strdup() returns NULL */
+ }
}
+ AST_RWLIST_UNLOCK(&actions);
+ return ret;
}
- AST_RWLIST_UNLOCK(&actions);
- return ret;
+
+ return NULL;
}
authority = ast_str_alloca(80);
if (a->argc != 4) {