]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(print_header): Print "1k-blocks", not "1.0k-blocks".
authorJim Meyering <jim@meyering.net>
Mon, 13 Jul 1998 00:17:57 +0000 (00:17 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 13 Jul 1998 00:17:57 +0000 (00:17 +0000)
src/df.c

index b4205a0b48e2f95ec6b964f571e1b0f5bf94f238..3b49c7708030209389a7988b7dfe7ce405e63717 100644 (file)
--- 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");