[Asterisk-cvs] asterisk pbx.c,1.178,1.179

markster at lists.digium.com markster at lists.digium.com
Tue Nov 30 20:29:28 CST 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv4641

Modified Files:
	pbx.c 
Log Message:
Print number of applications (bug #2961)


Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -d -r1.178 -r1.179
--- pbx.c	25 Nov 2004 02:57:34 -0000	1.178
+++ pbx.c	1 Dec 2004 01:28:07 -0000	1.179
@@ -2679,7 +2679,9 @@
 {
 	struct ast_app *a;
 	int like=0, describing=0;
-
+	int total_match = 0; 	/* Number of matches in like clause */
+	int total_apps = 0; 	/* Number of apps registered */
+	
 	/* try to lock applications list ... */
 	if (ast_mutex_lock(&applock)) {
 		ast_log(LOG_ERROR, "Unable to lock application list\n");
@@ -2711,10 +2713,11 @@
 	for (a = apps; a; a = a->next) {
 		/* ... show informations about applications ... */
 		int printapp=0;
-
+		total_apps++;
 		if (like) {
 			if (ast_strcasestr(a->name, argv[3])) {
 				printapp = 1;
+				total_match++;
 			}
 		} else if (describing) {
 			if (a->description) {
@@ -2724,6 +2727,8 @@
 				for (i=3;i<argc;i++) {
 					if (! ast_strcasestr(a->description, argv[i])) {
 						printapp = 0;
+					} else {
+						total_match++;
 					}
 				}
 			}
@@ -2735,7 +2740,12 @@
 			ast_cli(fd,"  %20s: %s\n", a->name, a->synopsis ? a->synopsis : "<Synopsis not available>");
 		}
 	}
-
+        if ((!like) && (!describing)) {
+		ast_cli(fd, "    -= %d Applications Registered =-\n",total_apps);
+	} else {
+		ast_cli(fd, "    -= %d Applications Matching =-\n",total_match);
+	}
+	
 	/* ... unlock and return */
 	ast_mutex_unlock(&applock);
 




More information about the svn-commits mailing list