[svn-commits] rizzo: trunk r47607 - /trunk/main/cli.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Nov 14 08:39:03 MST 2006


Author: rizzo
Date: Tue Nov 14 09:39:03 2006
New Revision: 47607

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47607
Log:
fix "core set debug atleast ",
and fix the simple case where a command can have multiple completions,
the first ones coming from keywords in previous CLI entries.

There is no solution yet for the complex case of N1 completions
from a CLI entry, followed by N2 from the next one, and so on,
because the _complete() handlers do not tell us how many matches
it generates, so we don't know how many to skip when interrogating
the other handlers.

The only solution is to avoid, as much as possible, multiple
CLI entries with the same prefix.


Modified:
    trunk/main/cli.c

Modified: trunk/main/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cli.c?view=diff&rev=47607&r1=47606&r2=47607
==============================================================================
--- trunk/main/cli.c (original)
+++ trunk/main/cli.c Tue Nov 14 09:39:03 2006
@@ -274,7 +274,7 @@
 	}
 	if (!strcasecmp(argv[e->args], "atleast"))
 		atleast = 1;
-	if (argc > e->args + atleast + 2)
+	if (argc < e->args + atleast + 1 || argc > e->args + atleast + 2)
 		return RESULT_SHOWUSAGE;
 	if (sscanf(argv[e->args + atleast], "%d", &newlevel) != 1)
 		return RESULT_SHOWUSAGE;
@@ -1675,7 +1675,7 @@
 					.fake = "-",
 					.line = matchstr, .word = word,
 					.pos = argindex,
-					.n = state };
+					.n = state - matchnum };
 				char *args[] = { (char *)e, (char *)&a, NULL };
 				ret = (char *)e->handler(-1, CLI_GENERATE, args + 1);
 			}



More information about the svn-commits mailing list