[asterisk-commits] trunk - r7851 /trunk/asterisk.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Jan 7 09:17:11 CST 2006


Author: markster
Date: Sat Jan  7 09:17:10 2006
New Revision: 7851

URL: http://svn.digium.com/view/asterisk?rev=7851&view=rev
Log:
Fix CLI breakage

Modified:
    trunk/asterisk.c

Modified: trunk/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/asterisk.c?rev=7851&r1=7850&r2=7851&view=diff
==============================================================================
--- trunk/asterisk.c (original)
+++ trunk/asterisk.c Sat Jan  7 09:17:10 2006
@@ -1511,7 +1511,7 @@
 
 	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 @@
 		} 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) {



More information about the asterisk-commits mailing list