mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
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: https://origsvn.digium.com/svn/asterisk/trunk@47827 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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(®exbuf);
|
||||
|
||||
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user