mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
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. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47607 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -274,7 +274,7 @@ static int handle_set_debug(int fd, int argc, char *argv[])
|
||||
}
|
||||
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 @@ static char *__ast_cli_generator(const char *text, const char *word, int state,
|
||||
.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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user