aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ac/ac.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2001-03-21 13:41:03 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2001-03-21 13:41:03 +0000
commit497c755856556cb2435dbd436f280003c155787a (patch)
tree0460412fdcd0c474c5602d7d41fa9984dcba143f /usr.sbin/ac/ac.c
parent5f94e68da9a72190f5be9e07a0972b9f799305a1 (diff)
downloadsrc-497c755856556cb2435dbd436f280003c155787a.tar.gz
src-497c755856556cb2435dbd436f280003c155787a.zip
Use nl_langinfo instead of %Ef
Notes
Notes: svn path=/head/; revision=74568
Diffstat (limited to 'usr.sbin/ac/ac.c')
-rw-r--r--usr.sbin/ac/ac.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/ac/ac.c b/usr.sbin/ac/ac.c
index 07d5bed1395b..e6b0ae2e18d3 100644
--- a/usr.sbin/ac/ac.c
+++ b/usr.sbin/ac/ac.c
@@ -23,6 +23,7 @@ static const char rcsid[] =
#include <sys/time.h>
#include <err.h>
#include <errno.h>
+#include <langinfo.h>
#include <locale.h>
#include <pwd.h>
#include <stdio.h>
@@ -322,9 +323,13 @@ show_today(users, logins, secs)
struct utmp_list *lp;
char date[64];
time_t yesterday = secs - 1;
+ static int d_first = -1;
- (void)strftime(date, sizeof (date), "%Ef total",
- localtime(&yesterday));
+ if (d_first < 0)
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+ (void)strftime(date, sizeof (date),
+ d_first ? "%e %b total" : "%b %e total",
+ localtime(&yesterday));
/* restore the missing second */
yesterday++;