From 67bf6815c49212468988a69c76ced0fb121ca845 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 8 Jul 2002 17:03:36 +0000 Subject: df now rounds all quantities up, as per POSIX. This fixes a bug where df would report Size < Used. (df_readable): Omit last arg; we always round up now. All callers changed. --- src/df.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/df.c b/src/df.c index af4b7e390..190d552df 100644 --- a/src/df.c +++ b/src/df.c @@ -213,13 +213,14 @@ excluded_fstype (const char *fstype) return 0; } -/* Like human_readable_inexact, except return "-" if the argument is -1, - and if NEGATIVE is 1 then N represents a negative number, expressed - in two's complement. */ +/* Like human_readable_inexact with a human_ceiling + human_inexact_style, except return "-" if the argument is -1, and + if NEGATIVE is 1 then N represents a negative number, expressed in + two's complement. */ + static char const * df_readable (int negative, uintmax_t n, char *buf, - int from_block_size, int t_output_block_size, - enum human_inexact_style s) + int from_block_size, int t_output_block_size) { if (n == -1) return "-"; @@ -228,7 +229,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, - negative ? - s : s); + human_ceiling); if (negative) *--p = '-'; return p; @@ -350,16 +351,11 @@ 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, - (posix_format - ? human_ceiling - : human_round_to_even)), + buf[0], input_units, output_units), width, df_readable (negate_used, used, - buf[1], input_units, output_units, - human_ceiling), + buf[1], input_units, output_units), width, df_readable (negate_available, available, - buf[2], input_units, output_units, - posix_format ? human_ceiling : human_floor)); + buf[2], input_units, output_units)); if (used == -1 || available == -1) ; -- cgit v1.2.3-54-g00ecf