summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-03-21 13:21:20 +0000
committerache <ache@FreeBSD.org>2001-03-21 13:21:20 +0000
commit222bae808450e1260199e3b663fe39ef21f4077b (patch)
tree34c1a66524931aa8fd2b659ca860a89b580755ce /bin
parentebb670b334996e0d7c30cdbb483ae7a36ab13337 (diff)
downloadFreeBSD-src-222bae808450e1260199e3b663fe39ef21f4077b.zip
FreeBSD-src-222bae808450e1260199e3b663fe39ef21f4077b.tar.gz
Use nl_langinfo instead of %Ef
Diffstat (limited to 'bin')
-rw-r--r--bin/ls/print.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/ls/print.c b/bin/ls/print.c
index a407283..ff7d092 100644
--- a/bin/ls/print.c
+++ b/bin/ls/print.c
@@ -50,6 +50,7 @@ static const char rcsid[] =
#include <errno.h>
#include <fts.h>
#include <grp.h>
+#include <langinfo.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -309,23 +310,23 @@ printtime(ftime)
char longstring[80];
static time_t now;
const char *format;
+ static d_first = -1;
+ if (d_first < 0)
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
if (now == 0)
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 || dd mmm hh:mm:ss yyyy */
- format = "%Ef %T %Y ";
+ format = d_first ? "%e %b %T %Y " : "%b %e %T %Y ";
else if (ftime + SIXMONTHS > now && ftime < now + SIXMONTHS)
/* mmm dd hh:mm || dd mmm hh:mm */
- format = "%Ef %R ";
+ format = d_first ? "%e %b %R " : "%b %e %R ";
else
/* mmm dd yyyy || dd mmm yyyy */
- format = "%Ef %Y ";
+ format = d_first ? "%e %b %Y " : "%b %e %Y ";
strftime(longstring, sizeof(longstring), format, localtime(&ftime));
fputs(longstring, stdout);
}
OpenPOWER on IntegriCloud