bug-glibc
[Top][All Lists]
Advanced

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

strftime and `-' (no-pad) directive has no effect on %e


From: Jim Meyering
Subject: strftime and `-' (no-pad) directive has no effect on %e
Date: Sun, 11 May 2003 17:15:43 +0200

I've just noticed that strftime's `-' (no-pad) directive has no effect on %e,
yet the `0' (zero-pad) directive does.

  $ date --date=2003-05-01 +%e
   1
  $ date --date=2003-05-01 +%0e
  01
  $ date --date=2003-05-01 +%-e
   1

Shouldn't `-' have an effect, too?

Here's a patch to that effect:

2003-05-11  Jim Meyering  <address@hidden>

        * time/strftime.c (my_strftime): Let the `-' (no-pad) flag affect
        the space-padded-by-default conversion specifiers, %e, %k, %l.

Index: strftime.c
===================================================================
RCS file: /cvs/glibc/libc/time/strftime.c,v
retrieving revision 1.93
diff -u -p -r1.93 strftime.c
--- strftime.c  19 Jan 2003 18:37:32 -0000      1.93
+++ strftime.c  11 May 2003 15:02:58 -0000
@@ -977,8 +977,8 @@ my_strftime (s, maxsize, format, tp ut_a
             jump to one of these two labels.  */
 
        do_number_spacepad:
-         /* Force `_' flag unless overwritten by `0' flag.  */
-         if (pad != L_('0'))
+         /* Force `_' flag unless overridden by `0' or `-' flag.  */
+         if (pad != L_('0') && pad != L_('-'))
            pad = L_('_');
 
        do_number:




reply via email to

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