DO NOT REPLY [Bug 5529] New: Use commas in displayed numbers - Tools

This is a discussion on DO NOT REPLY [Bug 5529] New: Use commas in displayed numbers - Tools ; https://bugzilla.samba.org/show_bug.cgi?id=5529 Summary: Use commas in displayed numbers Product: rsync Version: 3.0.2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P3 Component: core AssignedTo: wayned@samba.org ReportedBy: Dave@Yost.com QAContact: rsync-qa@samba.org foo/bar.mov 135227644 44% 48.07kB/s 0:58:07 should be foo/bar.mov 135,227,644 44% 48.07kB/s ...

+ Reply to Thread
Results 1 to 5 of 5

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

  1. DO NOT REPLY [Bug 5529] New: Use commas in displayed numbers

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

    Summary: Use commas in displayed numbers
    Product: rsync
    Version: 3.0.2
    Platform: All
    OS/Version: All
    Status: NEW
    Severity: enhancement
    Priority: P3
    Component: core
    AssignedTo: wayned@samba.org
    ReportedBy: Dave@Yost.com
    QAContact: rsync-qa@samba.org


    foo/bar.mov
    135227644 44% 48.07kB/s 0:58:07

    should be

    foo/bar.mov
    135,227,644 44% 48.07kB/s 0:58:07

    How many hours of our life to we waste painstakingly counting digits to see if
    a big number is 13MB or 135MB or 1.3GB? We can thank the fact that printf
    didn't offer to insert commas for that.


    --
    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.
    --
    Please use reply-all for most replies to avoid omitting the mailing list.
    To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
    Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


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

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





    ------- Comment #1 from idra@samba.org 2008-06-09 17:12 CST -------
    The problem is also that the separator is locale dependent, in some locales the
    separators "." and "," has the inverse meaning.

    That is: . is the thousands separator and , is the decimal part separator.

    If you need to add separators you must do it in a locale dependent way.


    --
    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.
    --
    Please use reply-all for most replies to avoid omitting the mailing list.
    To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
    Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


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

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





    ------- Comment #2 from jamie@shareable.org 2008-06-10 06:39 CST -------
    Fwiw, printf() _does_ insert commas if you ask for it - as a GNU extension. So
    suitable for GNU/Linux and some other environments.

    Write something like %'lld - the apostrophe modifier character asks for
    'thousands grouping character'.

    It is locale-dependent. Some locales use '.' to separate thousands, some have
    a different number of digits per group, and some don't do grouping.

    To do it somewhat portably, use localeconv(), nl_langinfo() and/or strfmon().
    The GNU libc manual explains (among other places).


    --
    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.
    --
    Please use reply-all for most replies to avoid omitting the mailing list.
    To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
    Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


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

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


    wayned@samba.org changed:

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




    ------- Comment #3 from wayned@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.
    --
    Please use reply-all for most replies to avoid omitting the mailing list.
    To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
    Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


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

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


    wayned@samba.org changed:

    What |Removed |Added
    ----------------------------------------------------------------------------
    Status|ASSIGNED |RESOLVED
    Resolution| |FIXED
    Version|3.0.2 |3.1.0




    ------- Comment #4 from wayned@samba.org 2008-09-06 09:52 CST -------
    The 3.1.0dev source now outputs numbers in this more readable fashion (with a
    way to turn it off, as desired).


    --
    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.
    --
    Please use reply-all for most replies to avoid omitting the mailing list.
    To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
    Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


+ Reply to Thread