Jim Meyering <[EMAIL PROTECTED]> writes: > BTW, I don't like the fact that the new %:z formats zero-fill by default, > when used with a wider field width, but I've left it as-is, for now.
Hmm, RFC 3339 requires the leading zero in "+07:00". Some people like "+7" and they can have that by specifying a smaller width. I agree that "+007" would be overkill (no pun intended), but my impression is that the code won't easily generate both "+07" and " +07". > * strftime.c (my_strftime): Parse the colons of %:::z *after* the > optional field width, not before, so we accept %9:z, not %:9z. Thanks for catching that. I tuned the patch slightly by installing this further patch. 2005-09-15 Paul Eggert <[EMAIL PROTECTED]> * strftime.c (my_strftime): Rewrite the previous change slightly, to make it a bit faster and (I hope) clearer. --- strftime.c 14 Sep 2005 16:10:38 -0000 1.91 +++ strftime.c 15 Sep 2005 18:47:56 -0000 1.92 @@ -492,7 +492,7 @@ my_strftime (CHAR_T *s, size_t maxsize, int width = -1; bool to_lowcase = false; bool to_uppcase = false; - size_t colons = 0; + size_t colons; bool change_case = false; int format_char; @@ -643,19 +643,6 @@ my_strftime (CHAR_T *s, size_t maxsize, break; } - /* Parse the colons of %:::z *after* the optional field width, - not before, so we accept %9:z, not %:9z. */ - { - const CHAR_T *q; - for (q = f; *q == L_(':') && q - f < 3; q++) - ; /* empty */ - if (*q == L_('z')) - { - colons = q - f; - f = q; - } - } - /* Now do the specified format. */ format_char = *f; switch (format_char) @@ -1320,7 +1307,20 @@ my_strftime (CHAR_T *s, size_t maxsize, #endif break; + case L_(':'): + /* :, ::, and ::: are valid only just before 'z'. + :::: etc. are rejected later. */ + for (colons = 1; f[colons] == L_(':'); colons++) + continue; + if (f[colons] != L_('z')) + goto bad_format; + f += colons; + goto do_z_conversion; + case L_('z'): + colons = 0; + + do_z_conversion: if (tp->tm_isdst < 0) break; _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils