Bring in a small change from team/russell/chan_refcount
authorRussell Bryant <russell@russellbryant.com>
Tue, 27 Nov 2007 22:42:57 +0000 (22:42 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 27 Nov 2007 22:42:57 +0000 (22:42 +0000)
This replaces tab completion code with the use of a public function that
does the same thing

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89835 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_misdn.c

index e727903..0dd77f8 100644 (file)
@@ -1665,31 +1665,9 @@ static char *handle_cli_misdn_send_display(struct ast_cli_entry *e, int cmd, str
        return CLI_SUCCESS;
 }
 
-static char *complete_ch_helper(struct ast_cli_args *a, int rpos)
-{
-       struct ast_channel *c;
-       int which = 0;
-       char *ret;
-       if (a->pos != rpos)
-               return NULL;
-       for (c = ast_channel_walk_locked(NULL); c; c = ast_channel_walk_locked(c)) {
-               if (!strncasecmp(a->word, c->name, strlen(a->word))) {
-                       if (++which > a->n)
-                               break;
-               }
-               ast_channel_unlock(c);
-       }
-       if (c) {
-               ret = ast_strdup(c->name);
-               ast_channel_unlock(c);
-       } else
-               ret = NULL;
-       return ret;
-}
-
 static char *complete_ch(struct ast_cli_args *a)
 {
-       return complete_ch_helper(a, 3);
+       return ast_complete_channels(a->line, a->word, a->pos, a->n, 3);
 }
 
 static char *complete_debug_port (struct ast_cli_args *a)