aboutsummaryrefslogtreecommitdiffstats
path: root/main/cli.c
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-27 22:27:09 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-27 22:27:09 +0000
commit99cf00120f21c030191b65f972725694fbe1f074 (patch)
tree8e1a0a3ac63c2580e71d13b6a74416ffd5277902 /main/cli.c
parentbdf1afb5af5b8a2af8cdca7c59fb5b9320fafa9f (diff)
Fix a segfault when trying to tab complete the "core show uptime" command.
Reported in #asterisk-dev on IRC by jcmoore, fixed by me. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@72326 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/cli.c')
-rw-r--r--main/cli.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/main/cli.c b/main/cli.c
index e2ddeb3c8..7607793ae 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -387,7 +387,7 @@ static char * handle_showuptime(struct ast_cli_entry *e, int cmd, struct ast_cli
switch (cmd) {
case CLI_INIT:
- e->command = "core show uptime";
+ e->command = "core show uptime [seconds]";
e->usage =
"Usage: core show uptime [seconds]\n"
" Shows Asterisk uptime information.\n"
@@ -395,12 +395,12 @@ static char * handle_showuptime(struct ast_cli_entry *e, int cmd, struct ast_cli
return NULL;
case CLI_GENERATE:
- return (a->pos > e->args || a->n > 0) ? NULL : "seconds";
+ return NULL;
}
/* regular handler */
- if (a->argc == e->args+1 && !strcasecmp(a->argv[e->args],"seconds"))
+ if (a->argc == e->args && !strcasecmp(a->argv[e->args-1],"seconds"))
printsec = 1;
- else if (a->argc == e->args)
+ else if (a->argc == e->args-1)
printsec = 0;
else
return CLI_SHOWUSAGE;