diff options
author | ache <ache@FreeBSD.org> | 2001-03-03 16:47:07 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-03-03 16:47:07 +0000 |
commit | 4d8aa303146db14062cdd24df31f6441ccf3957e (patch) | |
tree | 81581f4a160f04e00fa9dcab667ad34ee738b70d /usr.bin | |
parent | 182c65b1d948b69aea4e6629be3ad1c62a11a2df (diff) | |
download | FreeBSD-src-4d8aa303146db14062cdd24df31f6441ccf3957e.zip FreeBSD-src-4d8aa303146db14062cdd24df31f6441ccf3957e.tar.gz |
Preserve comma as separator when it is not equal to radix character
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/w/w.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index 26105d4..4126bca 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -100,6 +100,7 @@ int nflag; /* true if -n flag: don't convert addrs */ int dflag; /* true if -d flag: output debug info */ int sortidle; /* sort by idle time */ int use_ampm; /* use AM/PM time */ +int use_comma; /* use comma as floats separator */ char **sel_users; /* login array of particular users selected */ char domain[MAXHOSTNAMELEN]; @@ -143,6 +144,7 @@ main(argc, argv) (void)setlocale(LC_ALL, ""); use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0'); + use_comma = (*nl_langinfo(RADIXCHAR) != ','); /* Are we w(1) or uptime(1)? */ if (this_is_uptime(argv[0]) == 0) { @@ -476,8 +478,11 @@ pr_header(nowp, nusers) (void)printf(", no load average information available\n"); else { (void)printf(", load averages:"); - for (i = 0; i < (sizeof(avenrun) / sizeof(avenrun[0])); i++) - (void)printf(" %.2f", avenrun[i]); + for (i = 0; i < (sizeof(avenrun) / sizeof(avenrun[0])); i++) { + if (use_comma && i > 0) + (void)printf(","); + (void)printf(" %.2f", avenrun[i]); + } (void)printf("\n"); } } |