CLI: Cosmetic issue - core show uptime
[asterisk/asterisk.git] / main / cli.c
index eb8800f..e59a856 100644 (file)
@@ -802,7 +802,7 @@ static void print_uptimestr(int fd, struct timeval timeval, const char *prefix,
 #define DAY (HOUR*24)
 #define WEEK (DAY*7)
 #define YEAR (DAY*365)
-#define NEEDCOMMA(x) ((x)? ",": "")    /* define if we need a comma */
+#define NEEDCOMMA(x) ((x) ? ", " : "") /* define if we need a comma */
        if (timeval.tv_sec < 0) /* invalid, nothing to show */
                return;
 
@@ -814,31 +814,33 @@ static void print_uptimestr(int fd, struct timeval timeval, const char *prefix,
        if (timeval.tv_sec > YEAR) {
                x = (timeval.tv_sec / YEAR);
                timeval.tv_sec -= (x * YEAR);
-               ast_str_append(&out, 0, "%d year%s%s ", x, ESS(x),NEEDCOMMA(timeval.tv_sec));
+               ast_str_append(&out, 0, "%d year%s%s", x, ESS(x), NEEDCOMMA(timeval.tv_sec));
        }
        if (timeval.tv_sec > WEEK) {
                x = (timeval.tv_sec / WEEK);
                timeval.tv_sec -= (x * WEEK);
-               ast_str_append(&out, 0, "%d week%s%s ", x, ESS(x),NEEDCOMMA(timeval.tv_sec));
+               ast_str_append(&out, 0, "%d week%s%s", x, ESS(x), NEEDCOMMA(timeval.tv_sec));
        }
        if (timeval.tv_sec > DAY) {
                x = (timeval.tv_sec / DAY);
                timeval.tv_sec -= (x * DAY);
-               ast_str_append(&out, 0, "%d day%s%s ", x, ESS(x),NEEDCOMMA(timeval.tv_sec));
+               ast_str_append(&out, 0, "%d day%s%s", x, ESS(x), NEEDCOMMA(timeval.tv_sec));
        }
        if (timeval.tv_sec > HOUR) {
                x = (timeval.tv_sec / HOUR);
                timeval.tv_sec -= (x * HOUR);
-               ast_str_append(&out, 0, "%d hour%s%s ", x, ESS(x),NEEDCOMMA(timeval.tv_sec));
+               ast_str_append(&out, 0, "%d hour%s%s", x, ESS(x), NEEDCOMMA(timeval.tv_sec));
        }
        if (timeval.tv_sec > MINUTE) {
                x = (timeval.tv_sec / MINUTE);
                timeval.tv_sec -= (x * MINUTE);
-               ast_str_append(&out, 0, "%d minute%s%s ", x, ESS(x),NEEDCOMMA(timeval.tv_sec));
+               ast_str_append(&out, 0, "%d minute%s%s", x, ESS(x), NEEDCOMMA(timeval.tv_sec));
        }
        x = timeval.tv_sec;
-       if (x > 0 || ast_str_strlen(out) == 0)  /* if there is nothing, print 0 seconds */
-               ast_str_append(&out, 0, "%d second%s ", x, ESS(x));
+       if (x > 0 || ast_str_strlen(out) == 0) {
+               /* if there is nothing, print 0 seconds */
+               ast_str_append(&out, 0, "%d second%s", x, ESS(x));
+       }
        ast_cli(fd, "%s: %s\n", prefix, ast_str_buffer(out));
 }