Module Name: src
Committed By: mrg
Date: Sat Dec 3 03:26:27 UTC 2016
Modified Files:
src/usr.bin/systat: main.c systat.1
Log Message:
add a basic "-b" option - that outputs one display and exits.
inspired by "top -b". still requires a curses-capable output
without some fairly significant internal restructuring.
To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.bin/systat/main.c
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/systat/systat.1
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/systat/main.c
diff -u src/usr.bin/systat/main.c:1.50 src/usr.bin/systat/main.c:1.51
--- src/usr.bin/systat/main.c:1.50 Sat Oct 22 22:02:55 2016
+++ src/usr.bin/systat/main.c Sat Dec 3 03:26:27 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.50 2016/10/22 22:02:55 christos Exp $ */
+/* $NetBSD: main.c,v 1.51 2016/12/03 03:26:27 mrg Exp $ */
/*-
* Copyright (c) 1980, 1992, 1993
@@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: main.c,v 1.50 2016/10/22 22:02:55 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.51 2016/12/03 03:26:27 mrg Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -96,6 +96,7 @@ main(int argc, char **argv)
const char *all;
struct clockinfo clk;
size_t len;
+ int bflag = 0;
all = "all";
egid = getegid();
@@ -120,6 +121,9 @@ main(int argc, char **argv)
if ((turns = atoi(optarg)) <= 0)
errx(1, "turns <= 0.");
break;
+ case 'b':
+ bflag = !bflag;
+ break;
case '?':
default:
usage();
@@ -226,9 +230,12 @@ main(int argc, char **argv)
dellave = 0.0;
display(0);
- noecho();
- cbreak();
- keyboard();
+ if (!bflag) {
+ noecho();
+ cbreak();
+ keyboard();
+ } else
+ die(0);
/*NOTREACHED*/
}
Index: src/usr.bin/systat/systat.1
diff -u src/usr.bin/systat/systat.1:1.46 src/usr.bin/systat/systat.1:1.47
--- src/usr.bin/systat/systat.1:1.46 Wed Aug 3 13:09:43 2016
+++ src/usr.bin/systat/systat.1 Sat Dec 3 03:26:27 2016
@@ -1,4 +1,4 @@
-.\" $NetBSD: systat.1,v 1.46 2016/08/03 13:09:43 wiz Exp $
+.\" $NetBSD: systat.1,v 1.47 2016/12/03 03:26:27 mrg 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 August 2, 2016
+.Dd November 16, 2016
.Dt SYSTAT 1
.Os
.Sh NAME
@@ -37,7 +37,7 @@
.Nd display system statistics in a full-screen view
.Sh SYNOPSIS
.Nm
-.Op Fl n
+.Op Fl bn
.Op Fl M Ar core
.Op Fl N Ar system
.Op Fl t Ar turns
@@ -94,6 +94,8 @@ Extract the name list from
.Ar system
instead of the default
.Pa /netbsd .
+.It Fl b
+Show the chosen display once and exit.
.It Fl n
Do not resolve IP addresses into string hostnames
.Pq FQDNs
@@ -626,3 +628,8 @@ The
.Ic vmstat
display looks out of place because it is (it was added in as
a separate display from what used to be a different program).
+.Pp
+The
+.Fl b
+option requires a real terminal and could be converted to
+simply output to standard output.