aboutsummaryrefslogtreecommitdiffstats
path: root/main/cli.c
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-18 20:08:17 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-18 20:08:17 +0000
commit34f862cfb9e23cd2d2e538682d93ced11441f774 (patch)
tree0b225263da446cd3512b9f0338aa6052dd76e6e2 /main/cli.c
parented3d16c4d0c38bc0742880e468c41c802c03b367 (diff)
Move this macro from cli.c to cli.h so apps can use it
without duplicating the macro or the code: /*! * In many cases we need to print singular or plural * words depending on a count. This macro helps us e.g. * printf("we have %d object%s", n, ESS(n)); */ #define ESS(x) ((x) == 1 ? "" : "s") git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47827 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/cli.c')
-rw-r--r--main/cli.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/main/cli.c b/main/cli.c
index fdde50fff..09f848cdb 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -341,7 +341,6 @@ static void print_uptimestr(int fd, time_t timeval, const char *prefix, int prin
#define DAY (HOUR*24)
#define WEEK (DAY*7)
#define YEAR (DAY*365)
-#define ESS(x) ((x == 1) ? "" : "s") /* plural suffix */
#define NEEDCOMMA(x) ((x)? ",": "") /* define if we need a comma */
if (timeval < 0) /* invalid, nothing to show */
return;
@@ -938,7 +937,7 @@ static int group_show_channels(int fd, int argc, char *argv[])
if (havepattern)
regfree(&regexbuf);
- ast_cli(fd, "%d active channel%s\n", numchans, (numchans != 1) ? "s" : "");
+ ast_cli(fd, "%d active channel%s\n", numchans, ESS(numchans));
return RESULT_SUCCESS;
#undef FORMAT_STRING
}