Fwd: Bug#41144: incomplete or broken locale defns cause generalchaos
Geoff Keating
geoffk@ozemail.com.au
Sun Aug 22 18:43:00 GMT 1999
> Mailing-List: contact libc-alpha-help@sourceware.cygnus.com; run by ezmlm
> List-Unsubscribe: < mailto:libc-alpha-unsubscribe-geoffk=discus.anu.edu.au@sourceware.cygnus.com >
> List-Archive: < http://sourceware.cygnus.com/ml/libc-alpha/ >
> List-Post: < mailto:libc-alpha@sourceware.cygnus.com >
> List-Help: < mailto:libc-alpha-help@sourceware.cygnus.com >,
> < http://sourceware.cygnus.com/ml/#faqs >
> Date: Sun, 22 Aug 1999 14:28:34 -0700
> From: Joel Klecker <jk@espy.org>
> Cc: 41144-forwarded@bugs.debian.org
>
> [ Forwarded from the Debian Bug-tracking system, please keep
> 41144-forwarded@bugs.debian.org cc'ed so replies are recorded. ]
>
> Is this a bug? Is it feasible to fix?
>
> The data files are created using the install-locales makefile target.
This is a bug in 'date'. You can work around it by writing something
like
date '+%p '
the manual says:
_Warning:_ This convention for the return value which is prescribed
in ISO C can lead to problems in some situations. For certain
format strings and certain locales the output really can be the
empty string and this cannot be discovered by testing the return
value only. E.g., in most locales the AM/PM time format is not
supported (most of the world uses the 24 hour time
representation). In such locales `"%p"' will return the empty
string, i.e., the return value is zero. To detect situations like
this something similar to the following code should be used:
buf[0] = '\1';
len = strftime (buf, bufsize, format, tp);
if (len == 0 && buf[0] != '\0')
{
/* Something went wrong in the strftime call. */
...
}
--
Geoffrey Keating <geoffk@cygnus.com>
More information about the Libc-alpha
mailing list