aboutsummaryrefslogtreecommitdiffstats
path: root/main/cli.c
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-13 12:04:05 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-13 12:04:05 +0000
commit20893eb9b2aa4dbc17494460c152667733c4c3e7 (patch)
tree7eaaee7ea93831f2a826c38e8dff8efff218e879 /main/cli.c
parent7b4d165dafbeaec4487fa9f81e749e610351280d (diff)
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: http://svn.digium.com/svn/asterisk/trunk@47537 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/cli.c')
-rw-r--r--main/cli.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/main/cli.c b/main/cli.c
index b2432920c..cdbcc5605 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -1622,17 +1622,21 @@ static char *__ast_cli_generator(const char *text, const char *word, int state,
}
if (lock)
AST_LIST_LOCK(&helpers);
- while( !ret && (e = cli_next(&i)) ) {
+ while ((e = cli_next(&i))) {
int lc = strlen(e->_full_cmd);
if (e->_full_cmd[0] != '_' && lc > 0 && matchlen <= lc &&
!strncasecmp(matchstr, e->_full_cmd, matchlen)) {
/* 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 */
- } 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
command can have this occur */
- ret = e->generator(matchstr, word, argindex, state);
+ if (e->generator)
+ ret = e->generator(matchstr, word, argindex, state);
+ break;
}
}
if (lock)