Subject: humanize_number(9)/format_bytes(9) question
To: None <firstname.lastname@example.org>
From: Allen Briggs <email@example.com>
Date: 08/05/2000 10:53:05
I note that the man page for humanize_number didn't keep up with
sommerfeld's addition of the 'divisor' argument. I have changes
to update that man page, but I have another nit that I'd like to
either document or fix...
If you have:
format_bytes(buffer, sizeof(buffer), 4608ULL);
format_bytes(buffer, sizeof(buffer), 128 * 1024ULL);
in both cases. Also in both cases, format_bytes will return 6 because it
returns the value that humanize_number did. Humanize_number returned the
first buffer as
and format_bytes truncated it. These functions are defined to return
the number of characters stored in buffer (excluding the
terminating NUL) upon success, or -1 upon failure.
I'm inclined to say that they should return the number of characters
stored in buffer prior to the terminating NUL. This would mean a
simple adjustment to the return value as well as to the buffer if
the " B" is truncated. However, we lose a little bit of (IMO
irrelevant) information if we do that (i.e., that a couple extra
bytes of buffer beyond the current terminating NUL were touched).
So, does anyone have a problem with changing the return value of
format_bytes in this way?