another batch of cli simplifications

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@15857 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Luigi Rizzo
2006-03-28 23:33:02 +00:00
parent b94f6a6df4
commit 096bf1511f
3 changed files with 8 additions and 22 deletions

View File

@@ -1035,19 +1035,9 @@ static int console_autoanswer(int fd, int argc, char *argv[])
static char *autoanswer_complete(const char *line, const char *word, int pos, int state)
{
int l = strlen(word);
static char *choices[] = { "on", "off", NULL };
switch(state) {
case 0:
if (l && !strncasecmp(word, "on", MIN(l, 2)))
return ast_strdup("on");
case 1:
if (l && !strncasecmp(word, "off", MIN(l, 3)))
return ast_strdup("off");
default:
return NULL;
}
return NULL;
return (pos != 1) ? NULL : ast_cli_complete(word, choices, state);
}
static char autoanswer_usage[] =