Tue Jan 27 13:39:31 2015 UTC ()
Pull up following revision(s) (requested by prlw1 in ticket #461):
	usr.bin/pkill/pkill.c: revision 1.30
Simplify code so that gcc 4.8 can understand it.
http://mail-index.netbsd.org/tech-userlevel/2015/01/06/msg008882.html


(martin)
diff -r1.29 -r1.29.8.1 src/usr.bin/pkill/pkill.c

cvs diff -r1.29 -r1.29.8.1 src/usr.bin/pkill/pkill.c (expand / switch to unified diff)

--- src/usr.bin/pkill/pkill.c 2013/01/02 10:36:07 1.29
+++ src/usr.bin/pkill/pkill.c 2015/01/27 13:39:31 1.29.8.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pkill.c,v 1.29 2013/01/02 10:36:07 dsl Exp $ */ 1/* $NetBSD: pkill.c,v 1.29.8.1 2015/01/27 13:39:31 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran. 8 * by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34__RCSID("$NetBSD: pkill.c,v 1.29 2013/01/02 10:36:07 dsl Exp $"); 34__RCSID("$NetBSD: pkill.c,v 1.29.8.1 2015/01/27 13:39:31 martin Exp $");
35#endif /* !lint */ 35#endif /* !lint */
36 36
37#include <sys/types.h> 37#include <sys/types.h>
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/sysctl.h> 39#include <sys/sysctl.h>
40#include <sys/proc.h> 40#include <sys/proc.h>
41#include <sys/queue.h> 41#include <sys/queue.h>
42#include <sys/resource.h> 42#include <sys/resource.h>
43#include <sys/stat.h> 43#include <sys/stat.h>
44 44
45#include <stdio.h> 45#include <stdio.h>
46#include <stdlib.h> 46#include <stdlib.h>
47#include <limits.h> 47#include <limits.h>
@@ -118,28 +118,28 @@ main(int argc, char **argv) @@ -118,28 +118,28 @@ main(int argc, char **argv)
118 const struct kinfo_proc2 *kp; 118 const struct kinfo_proc2 *kp;
119 struct list *li; 119 struct list *li;
120 const char *p; 120 const char *p;
121 u_int32_t bestsec, bestusec; 121 u_int32_t bestsec, bestusec;
122 regex_t reg; 122 regex_t reg;
123 regmatch_t regmatch; 123 regmatch_t regmatch;
124 124
125 setprogname(argv[0]); 125 setprogname(argv[0]);
126 126
127 if (strcmp(getprogname(), "pgrep") == 0) { 127 if (strcmp(getprogname(), "pgrep") == 0) {
128 action = grepact; 128 action = grepact;
129 pgrep = 1; 129 pgrep = 1;
130 } else if (strcmp(getprogname(), "prenice") == 0) { 130 } else if (strcmp(getprogname(), "prenice") == 0) {
 131 action = reniceact;
131 prenice = 1; 132 prenice = 1;
132 
133 } else { 133 } else {
134 action = killact; 134 action = killact;
135 p = argv[1]; 135 p = argv[1];
136 136
137 if (argc > 1 && p[0] == '-') { 137 if (argc > 1 && p[0] == '-') {
138 p++; 138 p++;
139 i = (int)strtol(p, &q, 10); 139 i = (int)strtol(p, &q, 10);
140 if (*q == '\0') { 140 if (*q == '\0') {
141 signum = i; 141 signum = i;
142 argv++; 142 argv++;
143 argc--; 143 argc--;
144 } else { 144 } else {
145 if (strncasecmp(p, "sig", 3) == 0) 145 if (strncasecmp(p, "sig", 3) == 0)
@@ -161,27 +161,26 @@ main(int argc, char **argv) @@ -161,27 +161,26 @@ main(int argc, char **argv)
161 if (prenice) { 161 if (prenice) {
162 if (argc < 2) 162 if (argc < 2)
163 usage(); 163 usage();
164 164
165 if (strcmp(argv[1], "-l") == 0) { 165 if (strcmp(argv[1], "-l") == 0) {
166 longfmt = 1; 166 longfmt = 1;
167 argv++; 167 argv++;
168 argc--; 168 argc--;
169 } 169 }
170 170
171 if (argc < 2) 171 if (argc < 2)
172 usage(); 172 usage();
173 173
174 action = reniceact; 
175 p = argv[1]; 174 p = argv[1];
176 175
177 i = (int)strtol(p, &q, 10); 176 i = (int)strtol(p, &q, 10);
178 if (*q == '\0') { 177 if (*q == '\0') {
179 nicenum = i; 178 nicenum = i;
180 argv++; 179 argv++;
181 argc--; 180 argc--;
182 } else 181 } else
183 usage(); 182 usage();
184 } else { 183 } else {
185 while ((ch = getopt(argc, argv, "G:P:U:d:fg:ilns:t:u:vx")) != -1) 184 while ((ch = getopt(argc, argv, "G:P:U:d:fg:ilns:t:u:vx")) != -1)
186 switch (ch) { 185 switch (ch) {
187 case 'G': 186 case 'G':