<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7469">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">CLI: Fix remote console completion.<br><br>Duplicate checking was done incorrectly when parsing completion options<br>from a remote console causing all options to be ignored as duplicates.<br>Once fixed I had to separate processing of the best match to ensure it<br>was not identified as a duplicate when it is the only match.<br><br>Change-Id: Ibbdb29f88211742071836c9b3f4d2aa1221cd0f9<br>---<br>M main/asterisk.c<br>1 file changed, 11 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/69/7469/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/asterisk.c b/main/asterisk.c<br>index 2c86d1e..4ba621c 100644<br>--- a/main/asterisk.c<br>+++ b/main/asterisk.c<br>@@ -3012,10 +3012,17 @@<br> static struct ast_vector_string *ast_el_strtoarr(char *buf)<br> {<br>       char *retstr;<br>+        char *bestmatch;<br>      struct ast_vector_string *vec = ast_calloc(1, sizeof(*vec));<br> <br>       if (!vec) {<br>           return NULL;<br>+ }<br>+<br>+ /* bestmatch must not be deduplicated */<br>+     bestmatch = strsep(&buf, " ");<br>+ if (!bestmatch || !strcmp(bestmatch, AST_CLI_COMPLETE_EOF)) {<br>+                goto vector_cleanup;<br>  }<br> <br>  while ((retstr = strsep(&buf, " "))) {<br>@@ -3024,7 +3031,7 @@<br>           }<br> <br>          /* Older daemons sent duplicates. */<br>-         if (AST_VECTOR_GET_CMP(vec, retstr, strcasecmp)) {<br>+           if (AST_VECTOR_GET_CMP(vec, retstr, !strcasecmp)) {<br>                   continue;<br>             }<br> <br>@@ -3036,7 +3043,9 @@<br>           }<br>     }<br> <br>- if (!AST_VECTOR_SIZE(vec)) {<br>+ bestmatch = ast_strdup(bestmatch);<br>+   if (!bestmatch || AST_VECTOR_INSERT_AT(vec, 0, bestmatch)) {<br>+         ast_free(bestmatch);<br>          goto vector_cleanup;<br>  }<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7469">change 7469</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/7469"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ibbdb29f88211742071836c9b3f4d2aa1221cd0f9 </div>
<div style="display:none"> Gerrit-Change-Number: 7469 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>