summaryrefslogtreecommitdiffstats
path: root/bin/ps/ps.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-03-02 23:53:36 +0000
committerache <ache@FreeBSD.org>2001-03-02 23:53:36 +0000
commit0d5efacbf56c92f8d2b3ed41f72b0c928e6efb45 (patch)
treeb1808f8dc48f3c15fda2d81be061757003d8c529 /bin/ps/ps.c
parent98047335baabd6545b20432cdeeed011dcceb61b (diff)
downloadFreeBSD-src-0d5efacbf56c92f8d2b3ed41f72b0c928e6efb45.zip
FreeBSD-src-0d5efacbf56c92f8d2b3ed41f72b0c928e6efb45.tar.gz
Use AM/PM time only when available in locale
Diffstat (limited to 'bin/ps/ps.c')
-rw-r--r--bin/ps/ps.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 324ff6b..7d5aaee 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -58,14 +58,15 @@ static const char rcsid[] =
#include <errno.h>
#include <fcntl.h>
#include <kvm.h>
+#include <langinfo.h>
#include <limits.h>
+#include <locale.h>
#include <nlist.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <locale.h>
#include <pwd.h>
#include <utmp.h>
@@ -82,6 +83,7 @@ int rawcpu; /* -C */
int sumrusage; /* -S */
int termwidth; /* width of screen (0 == infinity) */
int totwidth; /* calculated width of requested variables */
+int use_ampm; /* use AM/PM time */
static int needuser, needcomm, needenv;
#if defined(LAZY_PS)
@@ -129,6 +131,7 @@ main(argc, argv)
char *nlistf, *memf, *swapf, errbuf[_POSIX2_LINE_MAX];
(void) setlocale(LC_ALL, "");
+ use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0');
if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == -1 &&
ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) == -1 &&
OpenPOWER on IntegriCloud