mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 12:20:12 +00:00
main/channel: Use ast_cli_completion_add for channeltypes.
Change-Id: Ia845fae6a84801cc7d9996767b99efb2753cbb48
This commit is contained in:
@@ -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)
|
static char *complete_channeltypes(struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
struct chanlist *cl;
|
struct chanlist *cl;
|
||||||
int which = 0;
|
|
||||||
int wordlen;
|
int wordlen;
|
||||||
char *ret = NULL;
|
|
||||||
|
|
||||||
if (a->pos != 3)
|
if (a->pos != 3) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
wordlen = strlen(a->word);
|
wordlen = strlen(a->word);
|
||||||
|
|
||||||
AST_RWLIST_RDLOCK(&backends);
|
AST_RWLIST_RDLOCK(&backends);
|
||||||
AST_RWLIST_TRAVERSE(&backends, cl, list) {
|
AST_RWLIST_TRAVERSE(&backends, cl, list) {
|
||||||
if (!strncasecmp(a->word, cl->tech->type, wordlen) && ++which > a->n) {
|
if (!strncasecmp(a->word, cl->tech->type, wordlen)) {
|
||||||
ret = ast_strdup(cl->tech->type);
|
ast_cli_completion_add(ast_strdup(cl->tech->type));
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AST_RWLIST_UNLOCK(&backends);
|
AST_RWLIST_UNLOCK(&backends);
|
||||||
|
|
||||||
return ret;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Show details about a channel driver - CLI command */
|
/*! \brief Show details about a channel driver - CLI command */
|
||||||
|
Reference in New Issue
Block a user