Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/systat PR/56331: Paul Goyette: Add -z option to disp...
details: https://anonhg.NetBSD.org/src/rev/954826bc36d2
branches: trunk
changeset: 985379:954826bc36d2
user: christos <christos%NetBSD.org@localhost>
date: Sat Aug 21 13:22:19 2021 +0000
description:
PR/56331: Paul Goyette: Add -z option to display 0 instead of ' ' in vmstat.
diffstat:
usr.bin/systat/extern.h | 3 ++-
usr.bin/systat/main.c | 28 ++++++++++++++++------------
usr.bin/systat/systat.1 | 8 +++++---
usr.bin/systat/vmstat.c | 10 +++++-----
4 files changed, 28 insertions(+), 21 deletions(-)
diffs (199 lines):
diff -r 4ce884fb6a4b -r 954826bc36d2 usr.bin/systat/extern.h
--- a/usr.bin/systat/extern.h Sat Aug 21 12:38:56 2021 +0000
+++ b/usr.bin/systat/extern.h Sat Aug 21 13:22:19 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.47 2019/01/25 15:31:11 christos Exp $ */
+/* $NetBSD: extern.h,v 1.48 2021/08/21 13:22:19 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -64,6 +64,7 @@
extern gid_t egid;
extern float hertz;
extern double etime;
+extern bool showzero;
struct inpcb;
#ifdef INET6
diff -r 4ce884fb6a4b -r 954826bc36d2 usr.bin/systat/main.c
--- a/usr.bin/systat/main.c Sat Aug 21 12:38:56 2021 +0000
+++ b/usr.bin/systat/main.c Sat Aug 21 13:22:19 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.55 2019/01/25 15:31:11 christos Exp $ */
+/* $NetBSD: main.c,v 1.56 2021/08/21 13:22:19 christos Exp $ */
/*-
* Copyright (c) 1980, 1992, 1993
@@ -36,7 +36,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: main.c,v 1.55 2019/01/25 15:31:11 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.56 2021/08/21 13:22:19 christos Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -81,6 +81,7 @@
sig_atomic_t needsredraw = 0;
float hertz;
double etime;
+bool showzero = false;
static WINDOW *wload; /* one line window for load average */
@@ -105,7 +106,7 @@
egid = getegid();
(void)setegid(getgid());
- while ((ch = getopt(argc, argv, "M:N:bnw:t:")) != -1)
+ while ((ch = getopt(argc, argv, "M:N:bnw:t:z")) != -1)
switch(ch) {
case 'M':
memf = optarg;
@@ -121,11 +122,14 @@
break;
case 't':
if ((turns = atoi(optarg)) <= 0)
- errx(1, "turns <= 0.");
+ errx(EXIT_FAILURE, "turns <= 0.");
break;
case 'w':
if ((naptime = strtod(optarg, NULL)) <= 0)
- errx(1, "interval <= 0.");
+ errx(EXIT_FAILURE, "interval <= 0.");
+ break;
+ case 'z':
+ showzero = true;
break;
case '?':
default:
@@ -177,7 +181,7 @@
kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
if (kd == NULL)
- errx(1, "%s", errbuf);
+ errx(EXIT_FAILURE, "%s", errbuf);
/* Get rid of privs for now. */
if (nlistf == NULL && memf == NULL)
@@ -195,7 +199,7 @@
* routines to minimize update work by curses.
*/
if (initscr() == NULL)
- errx(1, "couldn't initialize screen");
+ errx(EXIT_FAILURE, "couldn't initialize screen");
CMDLINE = LINES - 1;
wnd = (*curmode->c_open)();
@@ -248,9 +252,9 @@
static void
usage(void)
{
- fprintf(stderr, "usage: systat [-bn] [-M core] [-N system] [-w wait] "
- "[-t turns]\n\t\t[display] [refresh-interval]\n");
- exit(1);
+ fprintf(stderr, "usage: %s [-bnz] [-M core] [-N system] [-w wait] "
+ "[-t turns]\n\t\t[display] [refresh-interval]\n", getprogname());
+ exit(EXIT_FAILURE);
}
@@ -366,7 +370,7 @@
clrtoeol();
refresh();
endwin();
- exit(0);
+ exit(EXIT_SUCCESS);
}
void
@@ -417,7 +421,7 @@
clrtoeol();
refresh();
endwin();
- exit(1);
+ exit(EXIT_FAILURE);
}
bool
diff -r 4ce884fb6a4b -r 954826bc36d2 usr.bin/systat/systat.1
--- a/usr.bin/systat/systat.1 Sat Aug 21 12:38:56 2021 +0000
+++ b/usr.bin/systat/systat.1 Sat Aug 21 13:22:19 2021 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: systat.1,v 1.51 2018/12/28 12:21:53 wiz Exp $
+.\" $NetBSD: systat.1,v 1.52 2021/08/21 13:22:19 christos Exp $
.\"
.\" Copyright (c) 1985, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)systat.1 8.2 (Berkeley) 12/30/93
.\"
-.Dd December 26, 2018
+.Dd August 21, 2021
.Dt SYSTAT 1
.Os
.Sh NAME
@@ -37,7 +37,7 @@
.Nd display system statistics in a full-screen view
.Sh SYNOPSIS
.Nm
-.Op Fl bn
+.Op Fl bnz
.Op Fl M Ar core
.Op Fl N Ar system
.Op Fl t Ar turns
@@ -141,6 +141,8 @@
specified with the
.Fl w
flag.
+.It Fl z
+Display 0 instead of space when there is no data.
.El
.Pp
Certain characters cause immediate action by
diff -r 4ce884fb6a4b -r 954826bc36d2 usr.bin/systat/vmstat.c
--- a/usr.bin/systat/vmstat.c Sat Aug 21 12:38:56 2021 +0000
+++ b/usr.bin/systat/vmstat.c Sat Aug 21 13:22:19 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.89 2021/07/24 13:42:05 simonb Exp $ */
+/* $NetBSD: vmstat.c,v 1.90 2021/08/21 13:22:19 christos Exp $ */
/*-
* Copyright (c) 1983, 1989, 1992, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94";
#endif
-__RCSID("$NetBSD: vmstat.c,v 1.89 2021/07/24 13:42:05 simonb Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.90 2021/08/21 13:22:19 christos Exp $");
#endif /* not lint */
/*
@@ -743,7 +743,7 @@
if (move(l, c) != OK)
return;
- if (n == 0) {
+ if (n == 0 && !showzero) {
hline(' ', w);
return;
}
@@ -783,7 +783,7 @@
if (move(l, c) != OK)
return;
- if (n == 0) {
+ if (n == 0 && !showzero) {
hline(' ', w);
return;
}
@@ -805,7 +805,7 @@
if (move(l, c) != OK)
return;
- if (nz && f == 0.0) {
+ if (nz && f == 0.0 && !showzero) {
hline(' ', w);
return;
}
Home |
Main Index |
Thread Index |
Old Index