bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] df: add comments to help translators align column headers


From: Jim Meyering
Subject: Re: [PATCH] df: add comments to help translators align column headers
Date: Fri, 01 Jan 2010 17:01:15 +0100

Eric Blake wrote:

> According to Jim Meyering on 1/1/2010 4:02 AM:
>>    if (inode_format)
>> +    /* TRANSLATORS:
>> +       For best results (df header/column alignment), ensure that
>> +       your translation has the same length as the original.
>> +       Also, each column name translation should end at the same
>> +       column as the corresponding original.  */
>>      printf (_("    Inodes   IUsed   IFree IUse%%"));
>
> Why are we using printf instead of [f]puts on this line?

Because there has not yet been a crusade to eradicate every
last unnecessary *printf use ;-)

> Isn't the
> general policy to avoid the overhead of printf when there are no format
> specifiers (other than the %%, which can be simplified to % for puts)?

Yes, indeed.  I think I've systematically changed most of the
uses in usage functions, but obviously a few more remain.

I've just adapted these:

>From 84db964925680c912c601f616d4ab07f7bc19c3c Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 1 Jan 2010 16:56:03 +0100
Subject: [PATCH] df: use fputs in place of printf in a few more places

* src/df.c (print_header): Use fputs rather than printf in more places.
Suggested by Eric Blake.
---
 src/df.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/df.c b/src/df.c
index 0821fe1..b862879 100644
--- a/src/df.c
+++ b/src/df.c
@@ -161,13 +161,13 @@ print_header (void)
        your translation has the same length as the original.
        Also, each column name translation should end at the same
        column as the corresponding original.  */
-    printf (_("    Inodes   IUsed   IFree IUse%%"));
+    fputs (_("    Inodes   IUsed   IFree IUse%"), stdout);
   else if (human_output_opts & human_autoscale)
     {
       if (human_output_opts & human_base_1024)
-        printf (_("    Size  Used Avail Use%%"));
+        fputs (_("    Size  Used Avail Use%"), stdout);
       else
-        printf (_("     Size   Used  Avail Use%%"));
+        fputs (_("     Size   Used  Avail Use%"), stdout);
     }
   else if (posix_format)
     printf (_(" %s-blocks      Used Available Capacity"),
@@ -205,7 +205,7 @@ print_header (void)
               human_readable (output_block_size, buf, opts, 1, 1));
     }

-  printf (_(" Mounted on\n"));
+  fputs (_(" Mounted on\n"), stdout);
 }

 /* Is FSTYPE a type of file system that should be listed?  */
--
1.6.6.334.g442f




reply via email to

[Prev in Thread] Current Thread [Next in Thread]