]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
main/channel: Use ast_cli_completion_add for channeltypes.
authorCorey Farrell <git@cfware.com>
Sat, 9 Dec 2017 10:52:54 +0000 (05:52 -0500)
committerCorey Farrell <git@cfware.com>
Thu, 15 Mar 2018 12:25:44 +0000 (06:25 -0600)
Change-Id: Ia845fae6a84801cc7d9996767b99efb2753cbb48

main/channel.c

index 70e0bff8d5e1ef82ec1f3bfb6ade07955ef60a0e..72e7d4a59aa03a0f4f13c0c7766e276bd7b99c0d 100644 (file)
@@ -314,25 +314,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 */