aboutsummaryrefslogtreecommitdiffstats
path: root/asterisk.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-07 15:17:10 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-07 15:17:10 +0000
commit4a7380f1727af38ea547150280c33bfeef51ce0e (patch)
tree0386a68a9216869cafc8aceabc360f56becb8e94 /asterisk.c
parent713365557dee6a718873fe924af7f1b6bbd7b3aa (diff)
Fix CLI breakage
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7851 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'asterisk.c')
-rw-r--r--asterisk.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/asterisk.c b/asterisk.c
index 11363c851..2e475634c 100644
--- a/asterisk.c
+++ b/asterisk.c
@@ -1511,7 +1511,7 @@ static int ast_cli_display_match_list(char **matches, int len, int max)
idx = 1;
- qsort(&matches[0], (size_t)(len + 1), sizeof(char *), ast_el_sort_compare);
+ qsort(&matches[0], (size_t)(len), sizeof(char *), ast_el_sort_compare);
for (; count > 0; count--) {
numoutputline = 0;
@@ -1603,12 +1603,14 @@ static char *cli_complete(EditLine *el, int ch)
} else
matches = (char **) NULL;
} else {
- char **p;
- int count = 0;
+ char **p, *oldbuf=NULL;
+ nummatches = 0;
matches = ast_cli_completion_matches((char *)lf->buffer,ptr);
- for (p = matches; p && *p; p++)
- count++;
- nummatches = count - 1; /* XXX apparently there is one dup ? */
+ for (p = matches; p && *p; p++) {
+ if (!oldbuf || strcmp(*p,oldbuf))
+ nummatches++;
+ oldbuf = *p;
+ }
}
if (matches) {