Index: loader.c =================================================================== RCS file: /usr/cvsroot/asterisk/loader.c,v retrieving revision 1.27 diff -u -r1.27 loader.c --- loader.c 8 Oct 2004 18:20:49 -0000 1.27 +++ loader.c 14 Oct 2004 00:39:54 -0000 @@ -460,7 +460,7 @@ } -int ast_update_module_list(int (*modentry)(char *module, char *description, int usecnt)) +int ast_update_module_list(int (*modentry)(char *module, char *description, int usecnt, char *like), char *like) { struct module *m; int unlock = -1; @@ -468,10 +468,10 @@ if (ast_mutex_trylock(&modlock)) unlock = 0; m = module_list; + //char *like = "chan_a"; while(m) { - modentry(m->resource, m->description(), m->usecount()); + total_mod_loaded += modentry(m->resource, m->description(), m->usecount(), like); m = m->next; - total_mod_loaded++; } if (unlock) ast_mutex_unlock(&modlock); Index: cli.c =================================================================== RCS file: /usr/cvsroot/asterisk/cli.c,v retrieving revision 1.56 diff -u -r1.56 cli.c --- cli.c 8 Oct 2004 18:20:49 -0000 1.56 +++ cli.c 14 Oct 2004 00:39:55 -0000 @@ -213,16 +213,21 @@ AST_MUTEX_DEFINE_STATIC(climodentrylock); static int climodentryfd = -1; -static int modlist_modentry(char *module, char *description, int usecnt) +static int modlist_modentry(char *module, char *description, int usecnt, char *like) { - ast_cli(climodentryfd, MODLIST_FORMAT, module, description, usecnt); + /* Comparing the like with the module */ + int total_matching = 0; + if ( strstr(module,like) != NULL) { + ast_cli(climodentryfd, MODLIST_FORMAT, module, description, usecnt); + return 1; + + } return 0; } static char modlist_help[] = -"Usage: show modules\n" -" Shows Asterisk modules currently in use, and usage " -"statistics.\n"; +"Usage: show modules [like keyword]\n" +" Shows Asterisk modules currently in use, and usage statistics.\n"; static char version_help[] = "Usage: show version\n" @@ -332,12 +337,19 @@ static int handle_modlist(int fd, int argc, char *argv[]) { - if (argc != 2) + char *like = ""; + if (argc == 3) return RESULT_SHOWUSAGE; + else if (argc >= 4) { + if ( strcmp(argv[2],"like") ) + return RESULT_SHOWUSAGE; + like = argv[3]; + } + ast_mutex_lock(&climodentrylock); climodentryfd = fd; ast_cli(fd, MODLIST_FORMAT2, "Module", "Description", "Use Count"); - ast_cli(fd,"%d modules loaded\n",ast_update_module_list(modlist_modentry)); + ast_cli(fd,"%d modules loaded\n",ast_update_module_list(modlist_modentry,like)); climodentryfd = -1; ast_mutex_unlock(&climodentrylock); return RESULT_SUCCESS; Index: include/asterisk/module.h =================================================================== RCS file: /usr/cvsroot/asterisk/include/asterisk/module.h,v retrieving revision 1.12 diff -u -r1.12 module.h --- include/asterisk/module.h 2 Sep 2004 20:45:24 -0000 1.12 +++ include/asterisk/module.h 14 Oct 2004 00:39:55 -0000 @@ -114,7 +114,7 @@ * For each of the modules loaded, modentry will be executed with the resource, description, * and usecount values of each particular module. */ -int ast_update_module_list(int (*modentry)(char *module, char *description, int usecnt)); +int ast_update_module_list(int (*modentry)(char *module, char *description, int usecnt, char *like), char *like); //! Ask this procedure to be run with modules have been updated /*!