summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2016-10-13 11:22:46 +0000
committerotto <otto@openbsd.org>2016-10-13 11:22:46 +0000
commitccefb7fe0f3042b96e3905e3116aec993e4c5e67 (patch)
tree3e3cf40b6b83c7b71a3361d0357547bd6214071b
parentSome improvements and bug fixes for hooks: (diff)
downloadwireguard-openbsd-ccefb7fe0f3042b96e3905e3116aec993e4c5e67.tar.xz
wireguard-openbsd-ccefb7fe0f3042b96e3905e3116aec993e4c5e67.zip
tweak previous; hostname is alredy available plus some better formatting
in case line numbers and/or PAUSED is shown; ok tedu@
-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);