summaryrefslogtreecommitdiffstats
path: root/bin/ps/print.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-02-11 02:25:56 +0000
committerache <ache@FreeBSD.org>2001-02-11 02:25:56 +0000
commit98d8c3737a7d79fa8f7a78c98c5ce85ee8fde7f9 (patch)
tree811bd01f17b4cd3a200102f4eff9596f0c13c151 /bin/ps/print.c
parent0c50457380634aeb3bac493686d48bd4ff342a95 (diff)
downloadFreeBSD-src-98d8c3737a7d79fa8f7a78c98c5ce85ee8fde7f9.zip
FreeBSD-src-98d8c3737a7d79fa8f7a78c98c5ce85ee8fde7f9.tar.gz
Use decimal point from locale
Diffstat (limited to 'bin/ps/print.c')
-rw-r--r--bin/ps/print.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 34964f5..ebcce4f 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -51,6 +51,7 @@ static const char rcsid[] =
#include <vm/vm.h>
#include <err.h>
+#include <locale.h>
#include <math.h>
#include <nlist.h>
#include <stddef.h>
@@ -478,7 +479,10 @@ cputime(k, ve)
long secs;
long psecs; /* "parts" of a second. first micro, then centi */
char obuff[128];
+ static char decimal_point = 0;
+ if (!decimal_point)
+ decimal_point = localeconv()->decimal_point[0];
v = ve->var;
if (k->ki_p->ki_stat == SZOMB || !k->ki_valid) {
secs = 0;
@@ -503,7 +507,7 @@ cputime(k, ve)
psecs = psecs % 100;
}
(void)snprintf(obuff, sizeof(obuff),
- "%3ld:%02ld.%02ld", secs/60, secs%60, psecs);
+ "%3ld:%02ld%c%02ld", secs/60, secs%60, decimal_point, psecs);
(void)printf("%*s", v->width, obuff);
}
OpenPOWER on IntegriCloud