diff options
author | Wayne Davison <wayned@samba.org> | 2009-02-17 13:22:28 -0800 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2009-02-18 07:26:48 -0800 |
commit | df7ec1cf428ef45f255589a5ca662cfb25724510 (patch) | |
tree | 8a1ffdf29b83dd2ed3367fd4f05c04e2dff92e0f /log.c | |
parent | 6437b817c0023cf54f4054e25b7f7947084a1048 (diff) | |
download | rsync-df7ec1cf428ef45f255589a5ca662cfb25724510.tar.gz |
Adding a way for log-format numbers to become more human readable.
Diffstat (limited to 'log.c')
-rw-r--r-- | log.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -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': |