diff options
author | Jim Meyering <jim@meyering.net> | 2000-06-16 12:49:20 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-06-16 12:49:20 +0000 |
commit | f570d032b4adc1193c96e093b119ec0129508885 (patch) | |
tree | e1d49555cbdacde5ba6ca9725b00375ad2d1c7cc /src | |
parent | 0e2ebc67e23c1eb9b1f7fae630ba5d33dcbae238 (diff) | |
download | coreutils-f570d032b4adc1193c96e093b119ec0129508885.tar.xz |
(df_readable): New arg for rounding style.
Round negative numbers correctly.
(show_dev): Round disk usage up and disk free space down.
Diffstat (limited to 'src')
-rw-r--r-- | src/df.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -209,12 +209,12 @@ excluded_fstype (const char *fstype) return 0; } -/* Like human_readable, except return "-" if the argument is -1, - return the negative of N if NEGATIVE is 1, - and take ceiling of fractions if posix_format. */ +/* Like human_readable_inexact, except return "-" if the argument is -1, + and return the negative of N if NEGATIVE is 1. */ static char const * df_readable (int negative, uintmax_t n, char *buf, - int from_block_size, int t_output_block_size) + int from_block_size, int t_output_block_size, + enum human_inexact_style s) { if (n == -1) return "-"; @@ -223,9 +223,7 @@ df_readable (int negative, uintmax_t n, char *buf, char *p = human_readable_inexact (negative ? - n : n, buf + negative, from_block_size, t_output_block_size, - (posix_format - ? human_ceiling - : human_round_to_even)); + negative ? - s : s); if (negative) *--p = '-'; return p; @@ -347,11 +345,16 @@ show_dev (const char *disk, const char *mount_point, const char *fstype, printf (" %*s %*s %*s ", width, df_readable (0, total, - buf[0], input_units, output_units), + buf[0], input_units, output_units, + (posix_format + ? human_ceiling + : human_round_to_even)), width, df_readable (negate_used, used, - buf[1], input_units, output_units), + buf[1], input_units, output_units, + human_ceiling), width, df_readable (negate_available, available, - buf[2], input_units, output_units)); + buf[2], input_units, output_units, + posix_format ? human_ceiling : human_floor)); if (used != -1 && available != -1) { |