[asterisk-commits] trunk r28792 - in /trunk: cli.c pbx.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri May 19 12:35:17 MST 2006


Author: file
Date: Fri May 19 14:35:16 2006
New Revision: 28792

URL: http://svn.digium.com/view/asterisk?rev=28792&view=rev
Log:
Fix tab completion when you just do a plain tab without entering anything, and also fix show application tab completion. (issue #7089 reported by blitzrage)

Modified:
    trunk/cli.c
    trunk/pbx.c

Modified: trunk/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/cli.c?rev=28792&r1=28791&r2=28792&view=diff
==============================================================================
--- trunk/cli.c (original)
+++ trunk/cli.c Fri May 19 14:35:16 2006
@@ -1313,7 +1313,7 @@
 	int matchnum=0;
 	char *ret = NULL;
 	char matchstr[80] = "";
-	int tws;
+	int tws = 0;
 	char *dup = parse_args(text, &x, argv, sizeof(argv) / sizeof(argv[0]), &tws);
 
 	if (!dup)	/* error */
@@ -1321,9 +1321,12 @@
 	argindex = (!ast_strlen_zero(word) && x>0) ? x-1 : x;
 	/* rebuild the command, ignore tws */
 	ast_join(matchstr, sizeof(matchstr)-1, argv);
-	if (tws)
+	matchlen = strlen(matchstr);
+	if (tws) {
 		strcat(matchstr, " "); /* XXX */
-	matchlen = strlen(matchstr);
+		if (matchlen)
+			matchlen++;
+	}
 	if (lock)
 		AST_LIST_LOCK(&helpers);
 	while( !ret && (e = cli_next(&i)) ) {

Modified: trunk/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx.c?rev=28792&r1=28791&r2=28792&view=diff
==============================================================================
--- trunk/pbx.c (original)
+++ trunk/pbx.c Fri May 19 14:35:16 2006
@@ -2864,8 +2864,10 @@
 	/* return the n-th [partial] matching entry */
 	AST_LIST_LOCK(&apps);
 	AST_LIST_TRAVERSE(&apps, a, list) {
-		if (!strncasecmp(word, a->name, wordlen) && ++which > state)
+		if (!strncasecmp(word, a->name, wordlen) && ++which > state) {
 			ret = strdup(a->name);
+			break;
+		}
 	}
 	AST_LIST_UNLOCK(&apps);
 



More information about the asterisk-commits mailing list