Tue Oct 30 10:54:25 2018 UTC ()
Pull up the following revisions(s) (requested by mrg in ticket #1639):
	usr.bin/systat/main.c:	revision 1.52 via patch

Add missing 'b' to the list of options.
Alpha-sort the option handling.


(sborrill)
diff -r1.48.2.1 -r1.48.2.2 src/usr.bin/systat/main.c

cvs diff -r1.48.2.1 -r1.48.2.2 src/usr.bin/systat/main.c (expand / switch to unified diff)

--- src/usr.bin/systat/main.c 2017/09/04 06:04:06 1.48.2.1
+++ src/usr.bin/systat/main.c 2018/10/30 10:54:25 1.48.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: main.c,v 1.48.2.1 2017/09/04 06:04:06 snj Exp $ */ 1/* $NetBSD: main.c,v 1.48.2.2 2018/10/30 10:54:25 sborrill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1980, 1992, 1993 4 * Copyright (c) 1980, 1992, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34__COPYRIGHT("@(#) Copyright (c) 1980, 1992, 1993\ 34__COPYRIGHT("@(#) Copyright (c) 1980, 1992, 1993\
35 The Regents of the University of California. All rights reserved."); 35 The Regents of the University of California. All rights reserved.");
36#if 0 36#if 0
37static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; 37static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
38#endif 38#endif
39__RCSID("$NetBSD: main.c,v 1.48.2.1 2017/09/04 06:04:06 snj Exp $"); 39__RCSID("$NetBSD: main.c,v 1.48.2.2 2018/10/30 10:54:25 sborrill Exp $");
40#endif /* not lint */ 40#endif /* not lint */
41 41
42#include <sys/param.h> 42#include <sys/param.h>
43#include <sys/sysctl.h> 43#include <sys/sysctl.h>
44#include <sys/ioctl.h> 44#include <sys/ioctl.h>
45 45
46#include <ctype.h> 46#include <ctype.h>
47#include <err.h> 47#include <err.h>
48#include <errno.h> 48#include <errno.h>
49#include <limits.h> 49#include <limits.h>
50#include <signal.h> 50#include <signal.h>
51#include <stdarg.h> 51#include <stdarg.h>
52#include <stdio.h> 52#include <stdio.h>
@@ -92,47 +92,47 @@ int @@ -92,47 +92,47 @@ int
92main(int argc, char **argv) 92main(int argc, char **argv)
93{ 93{
94 int ch; 94 int ch;
95 char errbuf[_POSIX2_LINE_MAX]; 95 char errbuf[_POSIX2_LINE_MAX];
96 const char *all; 96 const char *all;
97 struct clockinfo clk; 97 struct clockinfo clk;
98 size_t len; 98 size_t len;
99 int bflag = 0; 99 int bflag = 0;
100 100
101 all = "all"; 101 all = "all";
102 egid = getegid(); 102 egid = getegid();
103 (void)setegid(getgid()); 103 (void)setegid(getgid());
104 104
105 while ((ch = getopt(argc, argv, "M:N:nw:t:")) != -1) 105 while ((ch = getopt(argc, argv, "M:N:bnw:t:")) != -1)
106 switch(ch) { 106 switch(ch) {
107 case 'M': 107 case 'M':
108 memf = optarg; 108 memf = optarg;
109 break; 109 break;
110 case 'N': 110 case 'N':
111 nlistf = optarg; 111 nlistf = optarg;
112 break; 112 break;
 113 case 'b':
 114 bflag = !bflag;
 115 break;
113 case 'n': 116 case 'n':
114 nflag = !nflag; 117 nflag = !nflag;
115 break; 118 break;
116 case 'w': 
117 if ((naptime = atoi(optarg)) <= 0) 
118 errx(1, "interval <= 0."); 
119 break; 
120 case 't': 119 case 't':
121 if ((turns = atoi(optarg)) <= 0) 120 if ((turns = atoi(optarg)) <= 0)
122 errx(1, "turns <= 0."); 121 errx(1, "turns <= 0.");
123 break; 122 break;
124 case 'b': 123 case 'w':
125 bflag = !bflag; 124 if ((naptime = strtod(optarg, NULL)) <= 0)
 125 errx(1, "interval <= 0.");
126 break; 126 break;
127 case '?': 127 case '?':
128 default: 128 default:
129 usage(); 129 usage();
130 } 130 }
131 argc -= optind; 131 argc -= optind;
132 argv += optind; 132 argv += optind;
133 133
134 134
135 for ( ; argc > 0; argc--, argv++) { 135 for ( ; argc > 0; argc--, argv++) {
136 struct mode *p; 136 struct mode *p;
137 int modefound = 0; 137 int modefound = 0;
138 138