[asterisk-commits] qwell: trunk r72326 - /trunk/main/cli.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 27 17:27:09 CDT 2007


Author: qwell
Date: Wed Jun 27 17:27:09 2007
New Revision: 72326

URL: http://svn.digium.com/view/asterisk?view=rev&rev=72326
Log:
Fix a segfault when trying to tab complete the "core show uptime" command.

Reported in #asterisk-dev on IRC by jcmoore, fixed by me.

Modified:
    trunk/main/cli.c

Modified: trunk/main/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cli.c?view=diff&rev=72326&r1=72325&r2=72326
==============================================================================
--- trunk/main/cli.c (original)
+++ trunk/main/cli.c Wed Jun 27 17:27:09 2007
@@ -387,7 +387,7 @@
 
 	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 @@
 		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;




More information about the asterisk-commits mailing list