fix the 'agi show commands' CLI function.
authorMichiel van Baak <michiel@vanbaak.info>
Sun, 12 Oct 2008 09:19:23 +0000 (09:19 +0000)
committerMichiel van Baak <michiel@vanbaak.info>
Sun, 12 Oct 2008 09:19:23 +0000 (09:19 +0000)
(closes issue #13666)
Reported by: eliel
Patches:
      res_agi.c.patch uploaded by eliel (license 64)

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

res/res_agi.c

index d4cbd6f..d2a2159 100644 (file)
@@ -2740,9 +2740,9 @@ static char *handle_cli_agi_show(struct ast_cli_entry *e, int cmd, struct ast_cl
        case CLI_GENERATE:
                return NULL;
        }
-       if (a->argc < e->args)
+       if (a->argc < e->args - 1 || (a->argc >= e->args && strcasecmp(a->argv[e->args - 1], "topic")))
                return CLI_SHOWUSAGE;
-       if (a->argc > e->args) {
+       if (a->argc > e->args - 1) {
                command = find_command(a->argv + e->args, 1);
                if (command) {
                        ast_cli(a->fd, "%s", command->usage);