]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(print_header): Rather than using a hard-coded literal
authorJim Meyering <jim@meyering.net>
Wed, 19 Feb 2003 16:05:07 +0000 (16:05 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 19 Feb 2003 16:05:07 +0000 (16:05 +0000)
string of spaces matching the length of the English `...Type' header,
output the right number of spaces to match the selected translation.
Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.

src/df.c

index 42b8f88c1242291c8ef87f56079d886abb2b7944..91db548ec5ee5ae647578e8f033d4d8cb0690d01 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -148,13 +148,16 @@ static void
 print_header (void)
 {
   char buf[MAX (LONGEST_HUMAN_READABLE + 1, INT_BUFSIZE_BOUND (uintmax_t))];
+  char const *type_header = _("   Type");
 
   printf (_("Filesystem "));
 
+  /* Print the `Type' header if required (--print-type, -T),
+     or an equivalent number of spaces.  */
   if (print_type)
-    printf (_("   Type"));
+    fputs (type_header, stdout);
   else
-    printf ("       ");
+    printf ("%-*s", strlen (type_header), "");
 
   if (inode_format)
     printf (_("    Inodes   IUsed   IFree IUse%%"));