diff options
author | Jim Meyering <jim@meyering.net> | 2000-11-12 09:48:14 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-11-12 09:48:14 +0000 |
commit | 1ff67f6c5cc2ef87cfcdf2b97f3eb27cfd569ba8 (patch) | |
tree | d19ad8baeb3feb761a2eea9e755d7b4acce2495e /src | |
parent | eabc99b8a477c4d4a94747fc7a26796f80030269 (diff) | |
download | coreutils-1ff67f6c5cc2ef87cfcdf2b97f3eb27cfd569ba8.tar.xz |
(<langinfo.h>): Include if HAVE_LANGINFO_H.
(DATE_FMT_LANGINFO): New macro, taken from sh-utils/src/date.c.
(print_long_format): Use it to determine "date" format.
Do not wrap "%b %e %Y" and "%b %e %H:%M" in _(), as it results in
incorrect behavior when LC_ALL is unset, LC_TIME is "C", and
LC_MESSAGES or LANG is set to something disagreeing with the POSIX
locale.
Diffstat (limited to 'src')
-rw-r--r-- | src/ls.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -114,6 +114,15 @@ int wcwidth (); # endif #endif +#if HAVE_LANGINFO_H +# include <langinfo.h> +#endif +#ifdef _DATE_FMT +# define DATE_FMT_LANGINFO() nl_langinfo (_DATE_FMT) +#else +# define DATE_FMT_LANGINFO() "" +#endif + #include "system.h" #include <fnmatch.h> @@ -2370,7 +2379,8 @@ print_long_format (const struct fileinfo *f) if (full_time) { - fmt = _("%a %b %d %H:%M:%S %Y"); + char *date_fmt = DATE_FMT_LANGINFO (); + fmt = *date_fmt ? date_fmt : "%a %b %e %H:%M:%S %Z %Y"; } else { @@ -2383,11 +2393,11 @@ print_long_format (const struct fileinfo *f) Allow a 1 hour slop factor for what is considered "the future", to allow for NFS server/client clock disagreement. Show the year instead of the time of day. */ - fmt = _("%b %e %Y"); + fmt = "%b %e %Y"; } else { - fmt = _("%b %e %H:%M"); + fmt = "%b %e %H:%M"; } } |