Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/usr.bin/systat Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/d02b4e261cc1
branches:  netbsd-7
changeset: 800321:d02b4e261cc1
user:      snj <snj%NetBSD.org@localhost>
date:      Mon Sep 04 06:04:06 2017 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #1491):
        usr.bin/systat/main.c: revision 1.51
        usr.bin/systat/systat.1: revision 1.47 via patch
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.

diffstat:

 usr.bin/systat/main.c   |  17 ++++++++++++-----
 usr.bin/systat/systat.1 |  13 ++++++++++---
 2 files changed, 22 insertions(+), 8 deletions(-)

diffs (97 lines):

diff -r 264dafda2e73 -r d02b4e261cc1 usr.bin/systat/main.c
--- a/usr.bin/systat/main.c     Fri Aug 25 03:49:54 2017 +0000
+++ b/usr.bin/systat/main.c     Mon Sep 04 06:04:06 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.48 2014/06/03 22:22:41 joerg Exp $  */
+/*     $NetBSD: main.c,v 1.48.2.1 2017/09/04 06:04:06 snj 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.48 2014/06/03 22:22:41 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.48.2.1 2017/09/04 06:04:06 snj Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -96,6 +96,7 @@
        const char *all;
        struct clockinfo clk;
        size_t len;
+       int bflag = 0;
 
        all = "all";
        egid = getegid();
@@ -120,6 +121,9 @@
                        if ((turns = atoi(optarg)) <= 0)
                                errx(1, "turns <= 0.");
                        break;
+               case 'b':
+                       bflag = !bflag;
+                       break;
                case '?':
                default:
                        usage();
@@ -226,9 +230,12 @@
        dellave = 0.0;
 
        display(0);
-       noecho();
-       cbreak();
-       keyboard();
+       if (!bflag) {
+               noecho();
+               cbreak();
+               keyboard();
+       } else
+               die(0);
        /*NOTREACHED*/
 }
 
diff -r 264dafda2e73 -r d02b4e261cc1 usr.bin/systat/systat.1
--- a/usr.bin/systat/systat.1   Fri Aug 25 03:49:54 2017 +0000
+++ b/usr.bin/systat/systat.1   Mon Sep 04 06:04:06 2017 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: systat.1,v 1.43 2013/10/18 22:42:31 bad Exp $
+.\"    $NetBSD: systat.1,v 1.43.4.1 2017/09/04 06:04:06 snj 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 October 19, 2012
+.Dd November 16, 2016
 .Dt SYSTAT 1
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd display system statistics on a CRT
 .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 @@
 .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
@@ -577,3 +579,8 @@
 .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.



Home | Main Index | Thread Index | Old Index