diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 2001-03-03 16:47:07 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 2001-03-03 16:47:07 +0000 |
commit | 2742fc8eb223787db530967fdf2024273c8a771a (patch) | |
tree | cdf4d3b54a7e447021e33495e09f75ff6c0735e8 /usr.bin/w/w.c | |
parent | a76decc6f7afc9eeb840a0efe942faa261969ae7 (diff) | |
download | src-2742fc8eb223787db530967fdf2024273c8a771a.tar.gz src-2742fc8eb223787db530967fdf2024273c8a771a.zip |
Preserve comma as separator when it is not equal to radix character
Notes
Notes:
svn path=/head/; revision=73385
Diffstat (limited to 'usr.bin/w/w.c')
-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 26105d488e1a..4126bcacaa09 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"); } } |