<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/8580">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">main/test: Use ast_cli_completion_add.<br><br>Change-Id: I5133ff2ba4e030f9733fb3d050c863d72a22ae6b<br>---<br>M main/test.c<br>1 file changed, 34 insertions(+), 34 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/test.c b/main/test.c<br>index d22f2eb..3fb1074 100644<br>--- a/main/test.c<br>+++ b/main/test.c<br>@@ -693,40 +693,40 @@<br> return test;<br> }<br> <br>-static char *complete_test_category(const char *line, const char *word, int pos, int state)<br>+static char *complete_test_category(const char *word)<br> {<br>- int which = 0;<br> int wordlen = strlen(word);<br>- char *ret = NULL;<br> struct ast_test *test;<br> <br> AST_LIST_LOCK(&tests);<br> AST_LIST_TRAVERSE(&tests, test, entry) {<br>- if (!strncasecmp(word, test->info.category, wordlen) && ++which > state) {<br>- ret = ast_strdup(test->info.category);<br>- break;<br>+ if (!strncasecmp(word, test->info.category, wordlen)) {<br>+ if (ast_cli_completion_add(ast_strdup(test->info.category))) {<br>+ break;<br>+ }<br> }<br> }<br> AST_LIST_UNLOCK(&tests);<br>- return ret;<br>+<br>+ return NULL;<br> }<br> <br>-static char *complete_test_name(const char *line, const char *word, int pos, int state, const char *category)<br>+static char *complete_test_name(const char *word, const char *category)<br> {<br>- int which = 0;<br> int wordlen = strlen(word);<br>- char *ret = NULL;<br> struct ast_test *test;<br> <br> AST_LIST_LOCK(&tests);<br> AST_LIST_TRAVERSE(&tests, test, entry) {<br>- if (!test_cat_cmp(test->info.category, category) && (!strncasecmp(word, test->info.name, wordlen) && ++which > state)) {<br>- ret = ast_strdup(test->info.name);<br>- break;<br>+ if (!test_cat_cmp(test->info.category, category) && !strncasecmp(word, test->info.name, wordlen)) {<br>+ if (ast_cli_completion_add(ast_strdup(test->info.name))) {<br>+ break;<br>+ }<br> }<br> }<br> AST_LIST_UNLOCK(&tests);<br>- return ret;<br>+<br>+ return NULL;<br> }<br> <br> /* CLI commands */<br>@@ -751,22 +751,22 @@<br> return NULL;<br> case CLI_GENERATE:<br> if (a->pos == 3) {<br>- return ast_cli_complete(a->word, option1, a->n);<br>+ return ast_cli_complete(a->word, option1, -1);<br> }<br>- if (a->pos == 4) {<br>- return complete_test_category(a->line, a->word, a->pos, a->n);<br>+ if (a->pos == 4 && !strcasecmp(a->argv[3], "category")) {<br>+ return complete_test_category(a->word);<br> }<br> if (a->pos == 5) {<br>- return ast_cli_complete(a->word, option2, a->n);<br>+ return ast_cli_complete(a->word, option2, -1);<br> }<br> if (a->pos == 6) {<br>- return complete_test_name(a->line, a->word, a->pos, a->n, a->argv[3]);<br>+ return complete_test_name(a->word, a->argv[4]);<br> }<br> return NULL;<br> case CLI_HANDLER:<br> if ((a->argc < 4) || (a->argc == 6) || (a->argc > 7) ||<br>- ((a->argc == 4) && strcmp(a->argv[3], "all")) ||<br>- ((a->argc == 7) && strcmp(a->argv[5], "name"))) {<br>+ ((a->argc == 4) && strcasecmp(a->argv[3], "all")) ||<br>+ ((a->argc == 7) && strcasecmp(a->argv[5], "name"))) {<br> return CLI_SHOWUSAGE;<br> }<br> ast_cli(a->fd, FORMAT, "Category", "Name", "Summary", "Test Result");<br>@@ -810,16 +810,16 @@<br> return NULL;<br> case CLI_GENERATE:<br> if (a->pos == 2) {<br>- return ast_cli_complete(a->word, option1, a->n);<br>+ return ast_cli_complete(a->word, option1, -1);<br> }<br>- if (a->pos == 3) {<br>- return complete_test_category(a->line, a->word, a->pos, a->n);<br>+ if (a->pos == 3 && !strcasecmp(a->argv[2], "category")) {<br>+ return complete_test_category(a->word);<br> }<br> if (a->pos == 4) {<br>- return ast_cli_complete(a->word, option2, a->n);<br>+ return ast_cli_complete(a->word, option2, -1);<br> }<br> if (a->pos == 5) {<br>- return complete_test_name(a->line, a->word, a->pos, a->n, a->argv[3]);<br>+ return complete_test_name(a->word, a->argv[3]);<br> }<br> return NULL;<br> case CLI_HANDLER:<br>@@ -828,7 +828,7 @@<br> return CLI_SHOWUSAGE;<br> }<br> <br>- if ((a->argc == 3) && !strcmp(a->argv[2], "all")) { /* run all registered tests */<br>+ if ((a->argc == 3) && !strcasecmp(a->argv[2], "all")) { /* run all registered tests */<br> ast_cli(a->fd, "Running all available tests...\n\n");<br> test_execute_multiple(NULL, NULL, a);<br> } else if (a->argc == 4) { /* run only tests within a category */<br>@@ -879,7 +879,7 @@<br> return NULL;<br> case CLI_GENERATE:<br> if (a->pos == 3) {<br>- return ast_cli_complete(a->word, option1, a->n);<br>+ return ast_cli_complete(a->word, option1, -1);<br> }<br> return NULL;<br> case CLI_HANDLER:<br>@@ -887,11 +887,11 @@<br> /* verify input */<br> if (a->argc != 4) {<br> return CLI_SHOWUSAGE;<br>- } else if (!strcmp(a->argv[3], "passed")) {<br>+ } else if (!strcasecmp(a->argv[3], "passed")) {<br> mode = 2;<br>- } else if (!strcmp(a->argv[3], "failed")) {<br>+ } else if (!strcasecmp(a->argv[3], "failed")) {<br> mode = 1;<br>- } else if (!strcmp(a->argv[3], "all")) {<br>+ } else if (!strcasecmp(a->argv[3], "all")) {<br> mode = 0;<br> } else {<br> return CLI_SHOWUSAGE;<br>@@ -952,7 +952,7 @@<br> return NULL;<br> case CLI_GENERATE:<br> if (a->pos == 3) {<br>- return ast_cli_complete(a->word, option, a->n);<br>+ return ast_cli_complete(a->word, option, -1);<br> }<br> return NULL;<br> case CLI_HANDLER:<br>@@ -960,10 +960,10 @@<br> /* verify input */<br> if (a->argc < 4 || a->argc > 5) {<br> return CLI_SHOWUSAGE;<br>- } else if (!strcmp(a->argv[3], "xml")) {<br>+ } else if (!strcasecmp(a->argv[3], "xml")) {<br> type = "xml";<br> isxml = 1;<br>- } else if (!strcmp(a->argv[3], "txt")) {<br>+ } else if (!strcasecmp(a->argv[3], "txt")) {<br> type = "txt";<br> } else {<br> return CLI_SHOWUSAGE;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8580">change 8580</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8580"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I5133ff2ba4e030f9733fb3d050c863d72a22ae6b </div>
<div style="display:none"> Gerrit-Change-Number: 8580 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>