Merge "main/taskprocessor: Use ast_cli_completion_add."
This commit is contained in:
commit
650f561bbb
|
@ -341,26 +341,27 @@ static void *tps_task_free(struct tps_task *task)
|
||||||
static char *tps_taskprocessor_tab_complete(struct ast_cli_args *a)
|
static char *tps_taskprocessor_tab_complete(struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
int tklen;
|
int tklen;
|
||||||
int wordnum = 0;
|
|
||||||
struct ast_taskprocessor *p;
|
struct ast_taskprocessor *p;
|
||||||
char *name = NULL;
|
|
||||||
struct ao2_iterator i;
|
struct ao2_iterator i;
|
||||||
|
|
||||||
if (a->pos != 3)
|
if (a->pos != 3) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
tklen = strlen(a->word);
|
tklen = strlen(a->word);
|
||||||
i = ao2_iterator_init(tps_singletons, 0);
|
i = ao2_iterator_init(tps_singletons, 0);
|
||||||
while ((p = ao2_iterator_next(&i))) {
|
while ((p = ao2_iterator_next(&i))) {
|
||||||
if (!strncasecmp(a->word, p->name, tklen) && ++wordnum > a->n) {
|
if (!strncasecmp(a->word, p->name, tklen)) {
|
||||||
name = ast_strdup(p->name);
|
if (ast_cli_completion_add(ast_strdup(p->name))) {
|
||||||
ast_taskprocessor_unreference(p);
|
ast_taskprocessor_unreference(p);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ast_taskprocessor_unreference(p);
|
ast_taskprocessor_unreference(p);
|
||||||
}
|
}
|
||||||
ao2_iterator_destroy(&i);
|
ao2_iterator_destroy(&i);
|
||||||
return name;
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ping task handling function */
|
/* ping task handling function */
|
||||||
|
|
Loading…
Reference in New Issue