aboutsummaryrefslogtreecommitdiffstats
path: root/asterisk.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2005-12-27 17:24:54 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2005-12-27 17:24:54 +0000
commit7f522f36e698a01bb39aa033e7d0334223ebed86 (patch)
tree90e7e4642b2e644803277595b91defbeaeb2a255 /asterisk.c
parent86532264b0e1c0657e526278328209df2c85fd18 (diff)
when doing tab completion, iterate the list of matches to count how many there
are instead of having the list of matches generated twice (issue #6066) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7655 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'asterisk.c')
-rw-r--r--asterisk.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/asterisk.c b/asterisk.c
index 54c9405fb..11363c851 100644
--- a/asterisk.c
+++ b/asterisk.c
@@ -1602,12 +1602,13 @@ static char *cli_complete(EditLine *el, int ch)
free(mbuf);
} else
matches = (char **) NULL;
-
-
} else {
-
- nummatches = ast_cli_generatornummatches((char *)lf->buffer,ptr);
+ char **p;
+ int count = 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 ? */
}
if (matches) {
@@ -1641,7 +1642,7 @@ static char *cli_complete(EditLine *el, int ch)
retval = CC_REFRESH;
}
}
- free(matches);
+ free(matches);
}
return (char *)(long)retval;