mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-08-05 08:10:15 +02:00
Revert part of last change and solve the problem a better way.
(show_date) [--rfc-822]: Set LC_ALL=C just before calling strftime and restore it just afterwards. Suggestion from Ulrich Drepper.
This commit is contained in:
+13
-5
@@ -488,11 +488,9 @@ show_date (const char *format, time_t when)
|
||||
return;
|
||||
}
|
||||
|
||||
if (rfc_format)
|
||||
setlocale (LC_TIME, "C");
|
||||
|
||||
do
|
||||
while (1)
|
||||
{
|
||||
int done;
|
||||
out_length += 200;
|
||||
out = (char *) xrealloc (out, out_length);
|
||||
|
||||
@@ -501,8 +499,18 @@ show_date (const char *format, time_t when)
|
||||
would not terminate when date was invoked like this
|
||||
`LANG=de date +%p' on a system with good language support. */
|
||||
out[0] = '\1';
|
||||
|
||||
if (rfc_format)
|
||||
setlocale (LC_ALL, "C");
|
||||
|
||||
done = (strftime (out, out_length, format, tm) || out[0] == '\0');
|
||||
|
||||
if (rfc_format)
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
if (done)
|
||||
break;
|
||||
}
|
||||
while (strftime (out, out_length, format, tm) == 0 && out[0] != '\0');
|
||||
|
||||
printf ("%s\n", out);
|
||||
free (out);
|
||||
|
||||
Reference in New Issue
Block a user