[Asterisk-cvs] asterisk cdr.c, 1.46, 1.47 cli.c, 1.88, 1.89 loader.c, 1.47, 1.48

kpfleming at lists.digium.com kpfleming at lists.digium.com
Thu Jul 7 18:23:39 CDT 2005


Update of /usr/cvsroot/asterisk
In directory localhost.localdomain:/tmp/cvs-serv16526

Modified Files:
	cdr.c cli.c loader.c 
Log Message:
make CLI output use singular/plural when appropriate (bug #4654)


Index: cdr.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cdr.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- cdr.c	20 Jun 2005 23:37:01 -0000	1.46
+++ cdr.c	7 Jul 2005 22:32:20 -0000	1.47
@@ -1052,10 +1052,10 @@
 				nextbatchtime = ast_sched_when(sched, cdr_sched);
 			ast_cli(fd, "CDR safe shut down: %s\n", batchsafeshutdown ? "enabled" : "disabled");
 			ast_cli(fd, "CDR batch threading model: %s\n", batchscheduleronly ? "scheduler only" : "scheduler plus separate threads");
-			ast_cli(fd, "CDR current batch size: %d record(s)\n", cnt);
-			ast_cli(fd, "CDR maximum batch size: %d record(s)\n", batchsize);
-			ast_cli(fd, "CDR maximum batch time: %d second(s)\n", batchtime);
-			ast_cli(fd, "CDR next scheduled batch processing time: %ld second(s)\n", nextbatchtime);
+			ast_cli(fd, "CDR current batch size: %d record%s\n", cnt, (cnt != 1) ? "s" : "");
+			ast_cli(fd, "CDR maximum batch size: %d record%s\n", batchsize, (batchsize != 1) ? "s" : "");
+			ast_cli(fd, "CDR maximum batch time: %d second%s\n", batchtime, (batchtime != 1) ? "s" : "");
+			ast_cli(fd, "CDR next scheduled batch processing time: %ld second%s\n", nextbatchtime, (nextbatchtime != 1) ? "s" : "");
 		}
 		AST_LIST_LOCK(&be_list);
 		AST_LIST_TRAVERSE(&be_list, beitem, list) {

Index: cli.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cli.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- cli.c	10 Jun 2005 20:25:23 -0000	1.88
+++ cli.c	7 Jul 2005 22:32:20 -0000	1.89
@@ -430,11 +430,11 @@
 		ast_mutex_unlock(&c->lock);
 	}
 	if(!concise) {
-		ast_cli(fd, "%d active channel(s)\n", numchans);
+		ast_cli(fd, "%d active channel%s\n", numchans, (numchans!=1) ? "s" : "");
 		if (option_maxcalls)
-			ast_cli(fd, "%d of %d max active call(s) (%5.2f%% of capacity)\n", ast_active_calls(), option_maxcalls, ((float)ast_active_calls() / (float)option_maxcalls) * 100.0);
+			ast_cli(fd, "%d of %d max active call%s (%5.2f%% of capacity)\n", ast_active_calls(), option_maxcalls, (ast_active_calls()!=1) ? "s" : "", ((float)ast_active_calls() / (float)option_maxcalls) * 100.0);
 		else
-			ast_cli(fd, "%d active call(s)\n", ast_active_calls());
+			ast_cli(fd, "%d active call%s\n", ast_active_calls(), (ast_active_calls()!=1) ? "s" : "");
 	}
 	return RESULT_SUCCESS;
 }

Index: loader.c
===================================================================
RCS file: /usr/cvsroot/asterisk/loader.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- loader.c	5 Jul 2005 22:11:42 -0000	1.47
+++ loader.c	7 Jul 2005 22:32:20 -0000	1.48
@@ -365,7 +365,7 @@
 		errors++;
 	}
 	if (errors) {
-		ast_log(LOG_WARNING, "%d error(s) loading module %s, aborted\n", errors, fn);
+		ast_log(LOG_WARNING, "%d error%s loading module %s, aborted\n", errors, (errors != 1) ? "s" : "", fn);
 		dlclose(m->lib);
 		free(m);
 		ast_mutex_unlock(&modlock);




More information about the svn-commits mailing list