summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2018-03-16 10:51:38 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2018-03-16 10:51:38 -0500
commit6c4719fc2a8674d9b378350e566b9c1a8c89f008 (patch)
tree0cba8dd792be51b079775ad597691af553508087
parenta33af7243cca3dfb465753ad6df7e6b037d37f81 (diff)
parentb929a7fb8d526802ed5fc426870619cb7775f7ba (diff)
Merge "main/channel: Use ast_cli_completion_add for channeltypes."
-rw-r--r--main/channel.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/main/channel.c b/main/channel.c
index 2779aa827..304fae18a 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -304,25 +304,23 @@ static char *handle_cli_core_show_channeltypes(struct ast_cli_entry *e, int cmd,
static char *complete_channeltypes(struct ast_cli_args *a)
{
struct chanlist *cl;
- int which = 0;
int wordlen;
- char *ret = NULL;
- if (a->pos != 3)
+ if (a->pos != 3) {
return NULL;
+ }
wordlen = strlen(a->word);
AST_RWLIST_RDLOCK(&backends);
AST_RWLIST_TRAVERSE(&backends, cl, list) {
- if (!strncasecmp(a->word, cl->tech->type, wordlen) && ++which > a->n) {
- ret = ast_strdup(cl->tech->type);
- break;
+ if (!strncasecmp(a->word, cl->tech->type, wordlen)) {
+ ast_cli_completion_add(ast_strdup(cl->tech->type));
}
}
AST_RWLIST_UNLOCK(&backends);
- return ret;
+ return NULL;
}
/*! \brief Show details about a channel driver - CLI command */