summaryrefslogtreecommitdiff
path: root/usr.bin/systat
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2016-10-13 11:22:47 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2016-10-13 11:22:47 +0000
commitd5e5e0ec0e74911979785a1a99ba4660b9f649cc (patch)
tree9f379f258ff74257d1243d8444ded72de38dcfd2 /usr.bin/systat
parent1ce190788f8a9771c0fdc87a578f903f52cb59d6 (diff)
tweak previous; hostname is alredy available plus some better formatting
in case line numbers and/or PAUSED is shown; ok tedu@
Diffstat (limited to 'usr.bin/systat')
-rw-r--r--usr.bin/systat/main.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c
index bade124729b..8c850d3329a 100644
--- a/usr.bin/systat/main.c
+++ b/usr.bin/systat/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.65 2016/10/13 05:46:20 tedu Exp $ */
+/* $Id: main.c,v 1.66 2016/10/13 11:22:46 otto Exp $ */
/*
* Copyright (c) 2001, 2007 Can Erkin Acar
* Copyright (c) 2001 Daniel Hartmeier
@@ -52,7 +52,7 @@
#include "engine.h"
#include "systat.h"
-#define TIMEPOS 55
+#define TIMEPOS (80 - 8 - 20 - 1)
double dellave;
@@ -67,7 +67,6 @@ int ut, hz, stathz;
char hostname[HOST_NAME_MAX+1];
WINDOW *wnd;
int CMDLINE;
-char hostbuf[26];
char timebuf[26];
char uloadbuf[TIMEPOS];
@@ -107,11 +106,9 @@ print_header(void)
getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
snprintf(uloadbuf, sizeof(uloadbuf),
- "%5d users Load %.2f %.2f %.2f",
+ "%4d users Load %.2f %.2f %.2f",
ucount(), avenrun[0], avenrun[1], avenrun[2]);
- gethostname(hostbuf, sizeof hostbuf);
-
time(&now);
ctim = ctime(&now);
ctim[11+8] = '\0';
@@ -127,7 +124,8 @@ print_header(void)
"%s %s", uloadbuf,
paused ? "PAUSED" : "");
- snprintf(header, sizeof(header), "%-45s%25.25s %s", tmpbuf, hostbuf, timebuf);
+ snprintf(header, sizeof(header), "%-*s %19.19s %s", TIMEPOS - 1,
+ tmpbuf, hostname, timebuf);
if (rawmode)
printf("\n\n%s\n", header);