From: Luigi Rizzo Date: Fri, 3 Nov 2006 18:13:26 +0000 (+0000) Subject: Fix "core show channels" and "core show modules". X-Git-Tag: 1.6.0-beta1~3^2~4140 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55f22da63f98505883370aa75977f5702fc3dfe1;p=thirdparty%2Fasterisk.git Fix "core show channels" and "core show modules". Not sure it applies like this to 1.4 because of deprecate versions of the same command(s). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47129 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/cli.c b/main/cli.c index ec576cfe86..ba299b5f86 100644 --- a/main/cli.c +++ b/main/cli.c @@ -416,15 +416,16 @@ static int handle_showuptime(int fd, int argc, char *argv[]) return RESULT_SUCCESS; } +/* core show modules [like keyword] */ static int handle_modlist(int fd, int argc, char *argv[]) { char *like = ""; - if (argc == 3) + if (argc != 3 && argc != 5) return RESULT_SHOWUSAGE; - else if (argc >= 4) { - if (strcmp(argv[2],"like")) + else if (argc == 5) { + if (strcmp(argv[3],"like")) return RESULT_SHOWUSAGE; - like = argv[3]; + like = argv[4]; } ast_mutex_lock(&climodentrylock); @@ -438,6 +439,7 @@ static int handle_modlist(int fd, int argc, char *argv[]) #undef MODLIST_FORMAT #undef MODLIST_FORMAT2 +/* core show channels [concise|verbose] */ static int handle_chanlist(int fd, int argc, char *argv[]) { #define FORMAT_STRING "%-20.20s %-20.20s %-7.7s %-30.30s\n" @@ -454,10 +456,12 @@ static int handle_chanlist(int fd, int argc, char *argv[]) int durh, durm, durs; int numchans = 0, concise = 0, verbose = 0; - concise = (argc == 3 && (!strcasecmp(argv[2],"concise"))); - verbose = (argc == 3 && (!strcasecmp(argv[2],"verbose"))); + if (argc == 4) { + concise = !strcasecmp(argv[2],"concise"); + verbose = !strcasecmp(argv[2],"verbose"); + } - if (argc < 2 || argc > 3 || (argc == 3 && !concise && !verbose)) + if (argc < 3 || argc > 4 || (argc == 4 && !concise && !verbose)) return RESULT_SHOWUSAGE; if (!concise && !verbose)