diff options
author | Jim Meyering <jim@meyering.net> | 2005-09-14 10:02:54 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2005-09-14 10:02:54 +0000 |
commit | ad9820269082f287e6c432550e96b9ddfbfb1f21 (patch) | |
tree | 3bd756324edfa6f0c268fda6b062aec7e0f2f86a /lib | |
parent | 4da72835472a9ef24fb222c2895809cdaa7112f1 (diff) | |
download | coreutils-ad9820269082f287e6c432550e96b9ddfbfb1f21.tar.xz |
(my_strftime): Parse the colons of %:::z *after* the
optional field width, not before, so we accept %9:z, not %:9z.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/strftime.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/strftime.c b/lib/strftime.c index 16342da8c..932166eaf 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -596,11 +596,6 @@ my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, pad = *f; continue; - /* This influences the %z format. */ - case L_(':'): - colons++; - continue; - /* This changes textual output. */ case L_('^'): to_uppcase = true; @@ -648,6 +643,19 @@ my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, 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 == ':' && q - f < 3; q++) + ; /* empty */ + if (*q == 'z') + { + colons = q - f; + f = q; + } + } + /* Now do the specified format. */ format_char = *f; switch (format_char) |