DO NOT REPLY [Bug 5529] Use commas in displayed numbers

samba-bugs at samba.org samba-bugs at samba.org
Sat Jun 14 17:27:15 GMT 2008


https://bugzilla.samba.org/show_bug.cgi?id=5529


wayned at samba.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




------- Comment #3 from wayned at samba.org  2008-06-14 12:27 CST -------
You can use the -h (--human-readable) option to ask rsync to display sizes with
suffixes, so you'd see 135.23M instead of 135227644.  An option to insert
commas (or periods) would be nice, though, and easy to do in the human_num()
routine that is already handling the numbers.  e.g., a version with commas
hard-wired:

--- a/util.c
+++ b/util.c
@@ -1197,6 +1197,7 @@ char *human_num(int64 num)
        static char bufs[4][128]; /* more than enough room */
        static unsigned int n;
        char *s;
+       int pos;

        n = (n + 1) % (sizeof bufs / sizeof bufs[0]);

@@ -1225,7 +1226,9 @@ char *human_num(int64 num)

        if (!num)
                *--s = '0';
-       while (num) {
+       for (pos = 0; num; pos++) {
+               if (pos && (pos % 3) == 0)
+                       *--s = ',';
                *--s = (char)(num % 10) + '0';
                num /= 10;
        }

Other changes would be needed to make room for the extra width in the progress
output, but I'll consider this for the future.


-- 
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


More information about the rsync mailing list