aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_clioriginate.c
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-28 23:06:46 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-28 23:06:46 +0000
commit8a81f683ed2be99d131499aea9a8d8d04d19ccff (patch)
tree3e37d391c81d9e89672ca483b845eea4532155e0 /res/res_clioriginate.c
parentde97942dd2b86c98ba6c0238a4638e959ff3207b (diff)
use ast_cli_complete() to largely simplify the command completion code.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@15852 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_clioriginate.c')
-rw-r--r--res/res_clioriginate.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/res/res_clioriginate.c b/res/res_clioriginate.c
index 36319f65f..e1ebaedfe 100644
--- a/res/res_clioriginate.c
+++ b/res/res_clioriginate.c
@@ -150,29 +150,15 @@ static int handle_orig(int fd, int argc, char *argv[])
static char *complete_orig(const char *line, const char *word, int pos, int state)
{
- int wordlen;
- char *app = "application";
- char *exten = "extension";
- char *ret = NULL;
+ static char *choices[] = { "application", "extension", NULL };
+ char *ret;
- if (pos != 2 || state)
+ if (pos != 2)
return NULL;
STANDARD_INCREMENT_USECOUNT;
- wordlen = strlen(word);
-
- if (ast_strlen_zero(word)) {
- /* show the options in alphabetical order */
- if (!state)
- ret = strdup(app);
- else
- ret = strdup(exten);
- } else if (!strncasecmp(word, app, wordlen)) {
- ret = strdup(app);
- } else if (!strncasecmp(word, exten, wordlen)) {
- ret = strdup(exten);
- }
+ ret = ast_cli_complete(word, choices, state);
STANDARD_DECREMENT_USECOUNT;