summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/df.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/df.c b/src/df.c
index b4205a0b4..3b49c7708 100644
--- a/src/df.c
+++ b/src/df.c
@@ -146,8 +146,14 @@ print_header (void)
else
{
char buf[LONGEST_HUMAN_READABLE + 1];
- printf (" %4s-blocks Used Available Use%%",
- human_readable (output_block_size, buf, 1, -1024));
+ char *p = human_readable (output_block_size, buf, 1, -1024);
+
+ /* Replace e.g. "1.0k" by "1k". */
+ size_t plen = strlen (p);
+ if (3 <= plen && strncmp (p + plen - 3, ".0", 2) == 0)
+ strcpy (p + plen - 3, p + plen - 1);
+
+ printf (" %4s-blocks Used Available Use%%", p);
}
printf (" Mounted on\n");