diff options
author | Jenkins2 <jenkins2@gerrit.asterisk.org> | 2018-03-19 06:17:42 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2018-03-19 06:17:42 -0500 |
commit | 19196a98d0bbaa0268e56a75f4d2908fc28c4c3f (patch) | |
tree | 9a4b4e137907fe1b5b3aef91c22ae35ec152a653 | |
parent | d5bfba60d2c609852da2f89677e878567d133674 (diff) | |
parent | ebe957c5e905e944ea9ac8b377ef6f1a4db7987b (diff) |
Merge "main/cdr: Use ast_cli_completion_add for CDR channel completion."
-rw-r--r-- | main/cdr.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/main/cdr.c b/main/cdr.c index 4acadf975..b0a48e1d6 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -3950,18 +3950,14 @@ static char *handle_cli_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_a /*! \brief Complete user input for 'cdr show' */ static char *cli_complete_show(struct ast_cli_args *a) { - char *result = NULL; int wordlen = strlen(a->word); - int which = 0; struct ao2_iterator it_cdrs; struct cdr_object *cdr; it_cdrs = ao2_iterator_init(active_cdrs_master, 0); while ((cdr = ao2_iterator_next(&it_cdrs))) { - if (!strncasecmp(a->word, cdr->party_a.snapshot->name, wordlen) && - (++which > a->n)) { - result = ast_strdup(cdr->party_a.snapshot->name); - if (result) { + if (!strncasecmp(a->word, cdr->party_a.snapshot->name, wordlen)) { + if (ast_cli_completion_add(ast_strdup(cdr->party_a.snapshot->name))) { ao2_ref(cdr, -1); break; } @@ -3969,7 +3965,8 @@ static char *cli_complete_show(struct ast_cli_args *a) ao2_ref(cdr, -1); } ao2_iterator_destroy(&it_cdrs); - return result; + + return NULL; } static void cli_show_channels(struct ast_cli_args *a) |