summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2009-02-17 13:22:28 -0800
committerWayne Davison <wayned@samba.org>2009-02-18 07:26:48 -0800
commitdf7ec1cf428ef45f255589a5ca662cfb25724510 (patch)
tree8a1ffdf29b83dd2ed3367fd4f05c04e2dff92e0f /log.c
parent6437b817c0023cf54f4054e25b7f7947084a1048 (diff)
downloadrsync-df7ec1cf428ef45f255589a5ca662cfb25724510.tar.gz
Adding a way for log-format numbers to become more human readable.
Diffstat (limited to 'log.c')
-rw-r--r--log.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/log.c b/log.c
index adde3c8e..a6873750 100644
--- a/log.c
+++ b/log.c
@@ -493,12 +493,21 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
buf[total] = '\0';
for (p = buf; (p = strchr(p, '%')) != NULL; ) {
+ int humanize = 0;
s = p++;
c = fmt + 1;
+ while (*p == '\'') {
+ humanize++;
+ p++;
+ }
if (*p == '-')
*c++ = *p++;
while (isDigit(p) && c - fmt < (int)(sizeof fmt) - 8)
*c++ = *p++;
+ while (*p == '\'') {
+ humanize++;
+ p++;
+ }
if (!*p)
break;
*c = '\0';
@@ -522,7 +531,7 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
case 'l':
strlcat(fmt, "s", sizeof fmt);
snprintf(buf2, sizeof buf2, fmt,
- comma_num(F_LENGTH(file)));
+ do_big_num(F_LENGTH(file), humanize, NULL));
n = buf2;
break;
case 'U':
@@ -639,7 +648,8 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
initial_stats->total_read;
}
strlcat(fmt, "s", sizeof fmt);
- snprintf(buf2, sizeof buf2, fmt, comma_num(b));
+ snprintf(buf2, sizeof buf2, fmt,
+ do_big_num(b, humanize, NULL));
n = buf2;
break;
case 'c':
@@ -651,7 +661,8 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
initial_stats->total_read;
}
strlcat(fmt, "s", sizeof fmt);
- snprintf(buf2, sizeof buf2, fmt, comma_num(b));
+ snprintf(buf2, sizeof buf2, fmt,
+ do_big_num(b, humanize, NULL));
n = buf2;
break;
case 'C':