summaryrefslogtreecommitdiff
path: root/utils/w.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-02-21 16:46:57 +0000
committerRoland McGrath <roland@gnu.org>1996-02-21 16:46:57 +0000
commit02f93f1b4e3be569f14aa2c8ae40bfec39004cac (patch)
tree8472095b3a37e9419d5a9f0220af3ecd696462cc /utils/w.c
parent16ac1d56eaa9601851cb4c1507b65addde9dc896 (diff)
(uptime): Use %.2f format for load average numbers.
Diffstat (limited to 'utils/w.c')
-rw-r--r--utils/w.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/utils/w.c b/utils/w.c
index 76bba7c6..39a67784 100644
--- a/utils/w.c
+++ b/utils/w.c
@@ -64,7 +64,7 @@ static struct argp_option options[] =
{"tty", 't', "TTY", OA, "Only show entries for terminal TTY"},
{"width", 'w', "WIDTH",OA, "If WIDTH is given, try to format the"
" output for WIDTH columns, otherwise,"
- " remove the default limit"},
+ " remove the default limit"},
{"uptime", 'u', 0, 0, "Only show the uptime and load info"},
{"no-uptime", 'U', 0, 0, "Don't show the uptime and load info"},
{"raw-hosts", 'n', 0, 0, "Show network addresses as numbers"},
@@ -248,7 +248,7 @@ add_utmp_procs (struct proc_stat_list *procs, struct utmp *u)
error (0, err, "%s", tty);
return;
}
-
+
/* The new process will get added at the end, so look for it there. */
pos = proc_stat_list_num_procs (procs);
if (pid >= 0)
@@ -337,16 +337,16 @@ uptime (proc_stat_list_t procs)
fmt_named_interval (&uptime, 0, uptime_rep, sizeof (uptime_rep));
- printf ("%s up %s, %u user%s, load averages: %g, %g, %g\n",
+ printf ("%s up %s, %u user%s, load averages: %.2f, %.2f, %.2f\n",
tod_rep, uptime_rep, nusers, nusers == 1 ? "" : "s",
- (float)load->avenrun[0] / (float)LOAD_SCALE,
- (float)load->avenrun[1] / (float)LOAD_SCALE,
- (float)load->avenrun[2] / (float)LOAD_SCALE);
+ (double)load->avenrun[0] / (double)LOAD_SCALE,
+ (double)load->avenrun[1] / (double)LOAD_SCALE,
+ (double)load->avenrun[2] / (double)LOAD_SCALE);
}
extern void psout ();
-void
+void
main(int argc, char *argv[])
{
error_t err;
@@ -407,7 +407,7 @@ main(int argc, char *argv[])
/* Keep only processes that have our hooks attached. */
proc_stat_list_filter1 (procs, has_hook, 0, 0);
-
+
if (show_uptime)
uptime (procs);