[asterisk-commits] rizzo: trunk r47815 - /trunk/main/cli.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Nov 17 15:02:16 MST 2006


Author: rizzo
Date: Fri Nov 17 16:02:15 2006
New Revision: 47815

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47815
Log:
standardize "module show [like]"


Modified:
    trunk/main/cli.c

Modified: trunk/main/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cli.c?view=diff&rev=47815&r1=47814&r2=47815
==============================================================================
--- trunk/main/cli.c (original)
+++ trunk/main/cli.c Fri Nov 17 16:02:15 2006
@@ -425,7 +425,7 @@
 
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "module show";
+		e->command = "module show [like]";
 		e->usage =
 			"Usage: module show [like keyword]\n"
 			"       Shows Asterisk modules currently in use, and usage statistics.\n";
@@ -433,8 +433,6 @@
 
 	case CLI_GENERATE:
 		if (a->pos == e->args)
-			return a->n == 0 ? strdup("like") : NULL;
-		else if (a->pos == e->args+1 && strcasestr(a->line," like "))
 			return ast_module_helper(a->line, a->word, a->pos, a->n, a->pos, 0);
 		else
 			return NULL;
@@ -442,10 +440,10 @@
 	/* all the above return, so we proceed with the handler.
 	 * we are guaranteed to have argc >= e->args
 	 */
-	if (a->argc == e->args)
+	if (a->argc == e->args - 1)
 		like = "";
-	else if (a->argc == e->args + 2 && !strcmp(a->argv[e->args],"like"))
-		like = a->argv[e->args + 1];
+	else if (a->argc == e->args + 1 && !strcasecmp(a->argv[e->args-1], "like") )
+		like = a->argv[e->args];
 	else
 		return CLI_SHOWUSAGE;
 		



More information about the asterisk-commits mailing list