mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
stop looking for new entries when we know we are done.
there is no functional change, so it is not necessary to bother merging this to 1.4 now. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47537 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
10
main/cli.c
10
main/cli.c
@@ -1622,17 +1622,21 @@ static char *__ast_cli_generator(const char *text, const char *word, int state,
|
|||||||
}
|
}
|
||||||
if (lock)
|
if (lock)
|
||||||
AST_LIST_LOCK(&helpers);
|
AST_LIST_LOCK(&helpers);
|
||||||
while( !ret && (e = cli_next(&i)) ) {
|
while ((e = cli_next(&i))) {
|
||||||
int lc = strlen(e->_full_cmd);
|
int lc = strlen(e->_full_cmd);
|
||||||
if (e->_full_cmd[0] != '_' && lc > 0 && matchlen <= lc &&
|
if (e->_full_cmd[0] != '_' && lc > 0 && matchlen <= lc &&
|
||||||
!strncasecmp(matchstr, e->_full_cmd, matchlen)) {
|
!strncasecmp(matchstr, e->_full_cmd, matchlen)) {
|
||||||
/* Found initial part, return a copy of the next word... */
|
/* Found initial part, return a copy of the next word... */
|
||||||
if (e->cmda[argindex] && ++matchnum > state)
|
if (e->cmda[argindex] && ++matchnum > state) {
|
||||||
ret = strdup(e->cmda[argindex]); /* we need a malloced string */
|
ret = strdup(e->cmda[argindex]); /* we need a malloced string */
|
||||||
} else if (e->generator && !strncasecmp(matchstr, e->_full_cmd, lc) && matchstr[lc] < 33) {
|
break;
|
||||||
|
}
|
||||||
|
} else if (!strncasecmp(matchstr, e->_full_cmd, lc) && matchstr[lc] < 33) {
|
||||||
/* We have a command in its entirity within us -- theoretically only one
|
/* We have a command in its entirity within us -- theoretically only one
|
||||||
command can have this occur */
|
command can have this occur */
|
||||||
|
if (e->generator)
|
||||||
ret = e->generator(matchstr, word, argindex, state);
|
ret = e->generator(matchstr, word, argindex, state);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lock)
|
if (lock)
|
||||||
|
Reference in New Issue
Block a user