aboutsummaryrefslogtreecommitdiff
path: root/bin/ls/print.c
diff options
context:
space:
mode:
authorJosef Karthauser <joe@FreeBSD.org>2000-06-21 21:49:57 +0000
committerJosef Karthauser <joe@FreeBSD.org>2000-06-21 21:49:57 +0000
commit1e715e3437fa99815cbbf82eb4705931c7c6d446 (patch)
treed73e1a35808c93f12f23479359ee76805af4adc0 /bin/ls/print.c
parentbdbfbf5ab92ee01b603d7dc4d0733b28474c30c9 (diff)
downloadsrc-1e715e3437fa99815cbbf82eb4705931c7c6d446.tar.gz
src-1e715e3437fa99815cbbf82eb4705931c7c6d446.zip
I broke locale sensitive ordering of date and month in
the long -l output format with the last commit. Fix it by replacing the "%b %e" strftime format with "%Ef". Make a note in the manual page that the LANG environment variable affects the running of ls. Reviewed by: ache
Notes
Notes: svn path=/head/; revision=61920
Diffstat (limited to 'bin/ls/print.c')
-rw-r--r--bin/ls/print.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/bin/ls/print.c b/bin/ls/print.c
index d397c1c7773f..736754abe292 100644
--- a/bin/ls/print.c
+++ b/bin/ls/print.c
@@ -301,15 +301,18 @@ printtime(ftime)
now = time(NULL);
#define SIXMONTHS ((365 / 2) * 86400)
+ /* "%Ef" is a FreeBSD strftime definition for "%e %b" or "%b %e".
+ * Actually format is locale sensitive.
+ */
if (f_sectime)
- /* Mmm dd hh:mm:ss yyyy */
- format = "%b %e %T %Y ";
+ /* mmm dd hh:mm:ss yyyy || dd mmm hh:mm:ss yyyy */
+ format = "%Ef %T %Y ";
else if (ftime + SIXMONTHS > now && ftime < now + SIXMONTHS)
- /* Mmm dd hh:mm */
- format = "%b %e %R ";
+ /* mmm dd hh:mm || dd mmm hh:mm */
+ format = "%Ef %R ";
else
- /* Mmm dd yyyy */
- format = "%b %e %Y ";
+ /* mmm dd yyyy || dd mmm yyyy */
+ format = "%Ef %Y ";
strftime(longstring, sizeof(longstring), format, localtime(&ftime));
fputs(longstring, stdout);
}