compare pointers with NULL not '\0'.diff -r1.33 -r1.34 src/bin/csh/lex.c
(mrg)
--- src/bin/csh/lex.c 2019/01/05 16:54:00 1.33
+++ src/bin/csh/lex.c 2019/02/01 08:29:03 1.34
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lex.c,v 1.33 2019/01/05 16:54:00 christos Exp $ */ | 1 | /* $NetBSD: lex.c,v 1.34 2019/02/01 08:29:03 mrg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1980, 1991, 1993 | 4 | * Copyright (c) 1980, 1991, 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. | |
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
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 | #if 0 | 34 | #if 0 | |
35 | static char sccsid[] = "@(#)lex.c 8.1 (Berkeley) 5/31/93"; | 35 | static char sccsid[] = "@(#)lex.c 8.1 (Berkeley) 5/31/93"; | |
36 | #else | 36 | #else | |
37 | __RCSID("$NetBSD: lex.c,v 1.33 2019/01/05 16:54:00 christos Exp $"); | 37 | __RCSID("$NetBSD: lex.c,v 1.34 2019/02/01 08:29:03 mrg Exp $"); | |
38 | #endif | 38 | #endif | |
39 | #endif /* not lint */ | 39 | #endif /* not lint */ | |
40 | 40 | |||
41 | #include <sys/ioctl.h> | 41 | #include <sys/ioctl.h> | |
42 | #include <sys/types.h> | 42 | #include <sys/types.h> | |
43 | 43 | |||
44 | #include <errno.h> | 44 | #include <errno.h> | |
45 | #include <stdarg.h> | 45 | #include <stdarg.h> | |
46 | #include <stdlib.h> | 46 | #include <stdlib.h> | |
47 | #include <string.h> | 47 | #include <string.h> | |
48 | #include <termios.h> | 48 | #include <termios.h> | |
49 | #include <unistd.h> | 49 | #include <unistd.h> | |
50 | 50 | |||
@@ -1313,50 +1313,50 @@ top: | @@ -1313,50 +1313,50 @@ top: | |||
1313 | if ((c = *alvecp++) != '\0') | 1313 | if ((c = *alvecp++) != '\0') | |
1314 | return (c); | 1314 | return (c); | |
1315 | if (alvec && *alvec) { | 1315 | if (alvec && *alvec) { | |
1316 | alvecp = *alvec++; | 1316 | alvecp = *alvec++; | |
1317 | return (' '); | 1317 | return (' '); | |
1318 | } | 1318 | } | |
1319 | else { | 1319 | else { | |
1320 | aret = F_SEEK; | 1320 | aret = F_SEEK; | |
1321 | alvecp = NULL; | 1321 | alvecp = NULL; | |
1322 | return('\n'); | 1322 | return('\n'); | |
1323 | } | 1323 | } | |
1324 | } | 1324 | } | |
1325 | if (alvec) { | 1325 | if (alvec) { | |
1326 | if ((alvecp = *alvec) != '\0') { | 1326 | if ((alvecp = *alvec) != NULL) { | |
1327 | alvec++; | 1327 | alvec++; | |
1328 | goto top; | 1328 | goto top; | |
1329 | } | 1329 | } | |
1330 | /* Infinite source! */ | 1330 | /* Infinite source! */ | |
1331 | return ('\n'); | 1331 | return ('\n'); | |
1332 | } | 1332 | } | |
1333 | if (evalp) { | 1333 | if (evalp) { | |
1334 | aret = E_SEEK; | 1334 | aret = E_SEEK; | |
1335 | if ((c = *evalp++) != '\0') | 1335 | if ((c = *evalp++) != '\0') | |
1336 | return (c); | 1336 | return (c); | |
1337 | if (evalvec && *evalvec) { | 1337 | if (evalvec && *evalvec) { | |
1338 | evalp = *evalvec++; | 1338 | evalp = *evalvec++; | |
1339 | return (' '); | 1339 | return (' '); | |
1340 | } | 1340 | } | |
1341 | aret = F_SEEK; | 1341 | aret = F_SEEK; | |
1342 | evalp = 0; | 1342 | evalp = 0; | |
1343 | } | 1343 | } | |
1344 | if (evalvec) { | 1344 | if (evalvec) { | |
1345 | if (evalvec == (Char **) 1) { | 1345 | if (evalvec == (Char **) 1) { | |
1346 | doneinp = 1; | 1346 | doneinp = 1; | |
1347 | reset(); | 1347 | reset(); | |
1348 | } | 1348 | } | |
1349 | if ((evalp = *evalvec) != '\0') { | 1349 | if ((evalp = *evalvec) != NULL) { | |
1350 | evalvec++; | 1350 | evalvec++; | |
1351 | goto top; | 1351 | goto top; | |
1352 | } | 1352 | } | |
1353 | evalvec = (Char **) 1; | 1353 | evalvec = (Char **) 1; | |
1354 | return ('\n'); | 1354 | return ('\n'); | |
1355 | } | 1355 | } | |
1356 | do { | 1356 | do { | |
1357 | if (arginp == (Char *) 1 || onelflg == 1) { | 1357 | if (arginp == (Char *) 1 || onelflg == 1) { | |
1358 | if (wanteof) | 1358 | if (wanteof) | |
1359 | return (-1); | 1359 | return (-1); | |
1360 | exitstat(); | 1360 | exitstat(); | |
1361 | } | 1361 | } | |
1362 | if (arginp) { | 1362 | if (arginp) { |
--- src/external/bsd/ppp/dist/pppd/options.c 2014/10/25 21:11:37 1.4
+++ src/external/bsd/ppp/dist/pppd/options.c 2019/02/01 08:29:04 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: options.c,v 1.4 2014/10/25 21:11:37 christos Exp $ */ | 1 | /* $NetBSD: options.c,v 1.5 2019/02/01 08:29:04 mrg Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * options.c - handles option processing for PPP. | 4 | * options.c - handles option processing for PPP. | |
5 | * | 5 | * | |
6 | * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved. | 6 | * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * | 11 | * | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * | 14 | * | |
@@ -37,27 +37,27 @@ | @@ -37,27 +37,27 @@ | |||
37 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | 37 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | |
38 | * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE | 38 | * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE | |
39 | * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 39 | * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
40 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN | 40 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN | |
41 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING | 41 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING | |
42 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 42 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
43 | */ | 43 | */ | |
44 | 44 | |||
45 | #include <sys/cdefs.h> | 45 | #include <sys/cdefs.h> | |
46 | #if 0 | 46 | #if 0 | |
47 | #define RCSID "Id: options.c,v 1.102 2008/06/15 06:53:06 paulus Exp " | 47 | #define RCSID "Id: options.c,v 1.102 2008/06/15 06:53:06 paulus Exp " | |
48 | static const char rcsid[] = RCSID; | 48 | static const char rcsid[] = RCSID; | |
49 | #else | 49 | #else | |
50 | __RCSID("$NetBSD: options.c,v 1.4 2014/10/25 21:11:37 christos Exp $"); | 50 | __RCSID("$NetBSD: options.c,v 1.5 2019/02/01 08:29:04 mrg Exp $"); | |
51 | #endif | 51 | #endif | |
52 | 52 | |||
53 | #include <ctype.h> | 53 | #include <ctype.h> | |
54 | #include <stdio.h> | 54 | #include <stdio.h> | |
55 | #include <errno.h> | 55 | #include <errno.h> | |
56 | #include <unistd.h> | 56 | #include <unistd.h> | |
57 | #include <fcntl.h> | 57 | #include <fcntl.h> | |
58 | #include <stdlib.h> | 58 | #include <stdlib.h> | |
59 | #include <syslog.h> | 59 | #include <syslog.h> | |
60 | #include <string.h> | 60 | #include <string.h> | |
61 | #include <pwd.h> | 61 | #include <pwd.h> | |
62 | #ifdef PLUGIN | 62 | #ifdef PLUGIN | |
63 | #include <dlfcn.h> | 63 | #include <dlfcn.h> | |
@@ -1777,27 +1777,27 @@ user_setprint(opt, printer, arg) | @@ -1777,27 +1777,27 @@ user_setprint(opt, printer, arg) | |||
1777 | } | 1777 | } | |
1778 | 1778 | |||
1779 | static int | 1779 | static int | |
1780 | user_unsetenv(argv) | 1780 | user_unsetenv(argv) | |
1781 | char **argv; | 1781 | char **argv; | |
1782 | { | 1782 | { | |
1783 | struct userenv *uep, **insp; | 1783 | struct userenv *uep, **insp; | |
1784 | char *arg = argv[0]; | 1784 | char *arg = argv[0]; | |
1785 | 1785 | |||
1786 | if (strchr(arg, '=') != NULL) { | 1786 | if (strchr(arg, '=') != NULL) { | |
1787 | option_error("unexpected = in name: %s", arg); | 1787 | option_error("unexpected = in name: %s", arg); | |
1788 | return 0; | 1788 | return 0; | |
1789 | } | 1789 | } | |
1790 | if (arg == '\0') { | 1790 | if (arg == NULL) { | |
1791 | option_error("missing variable name for unset"); | 1791 | option_error("missing variable name for unset"); | |
1792 | return 0; | 1792 | return 0; | |
1793 | } | 1793 | } | |
1794 | for (uep = userenv_list; uep != NULL; uep = uep->ue_next) { | 1794 | for (uep = userenv_list; uep != NULL; uep = uep->ue_next) { | |
1795 | if (strcmp(arg, uep->ue_name) == 0) | 1795 | if (strcmp(arg, uep->ue_name) == 0) | |
1796 | break; | 1796 | break; | |
1797 | } | 1797 | } | |
1798 | /* Ignore attempts by unprivileged users to override privileged sources */ | 1798 | /* Ignore attempts by unprivileged users to override privileged sources */ | |
1799 | if (uep != NULL && !privileged_option && uep->ue_priv) | 1799 | if (uep != NULL && !privileged_option && uep->ue_priv) | |
1800 | return 1; | 1800 | return 1; | |
1801 | /* The name never changes, so allocate it with the structure */ | 1801 | /* The name never changes, so allocate it with the structure */ | |
1802 | if (uep == NULL) { | 1802 | if (uep == NULL) { | |
1803 | uep = malloc(sizeof (*uep) + strlen(arg)); | 1803 | uep = malloc(sizeof (*uep) + strlen(arg)); |
--- src/usr.bin/basename/basename.c 2011/08/29 14:24:03 1.15
+++ src/usr.bin/basename/basename.c 2019/02/01 08:29:04 1.16
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: basename.c,v 1.15 2011/08/29 14:24:03 joerg Exp $ */ | 1 | /* $NetBSD: basename.c,v 1.16 2019/02/01 08:29:04 mrg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1991, 1993, 1994 | 4 | * Copyright (c) 1991, 1993, 1994 | |
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. | |
@@ -29,27 +29,27 @@ | @@ -29,27 +29,27 @@ | |||
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) 1991, 1993, 1994\ | 34 | __COPYRIGHT("@(#) Copyright (c) 1991, 1993, 1994\ | |
35 | The Regents of the University of California. All rights reserved."); | 35 | The Regents of the University of California. All rights reserved."); | |
36 | #endif /* not lint */ | 36 | #endif /* not lint */ | |
37 | 37 | |||
38 | #ifndef lint | 38 | #ifndef lint | |
39 | #if 0 | 39 | #if 0 | |
40 | static char sccsid[] = "@(#)basename.c 8.4 (Berkeley) 5/4/95"; | 40 | static char sccsid[] = "@(#)basename.c 8.4 (Berkeley) 5/4/95"; | |
41 | #endif | 41 | #endif | |
42 | __RCSID("$NetBSD: basename.c,v 1.15 2011/08/29 14:24:03 joerg Exp $"); | 42 | __RCSID("$NetBSD: basename.c,v 1.16 2019/02/01 08:29:04 mrg Exp $"); | |
43 | #endif /* not lint */ | 43 | #endif /* not lint */ | |
44 | 44 | |||
45 | #include <err.h> | 45 | #include <err.h> | |
46 | #include <libgen.h> | 46 | #include <libgen.h> | |
47 | #include <locale.h> | 47 | #include <locale.h> | |
48 | #include <stdio.h> | 48 | #include <stdio.h> | |
49 | #include <stdlib.h> | 49 | #include <stdlib.h> | |
50 | #include <string.h> | 50 | #include <string.h> | |
51 | #include <unistd.h> | 51 | #include <unistd.h> | |
52 | 52 | |||
53 | __dead static void usage(void); | 53 | __dead static void usage(void); | |
54 | 54 | |||
55 | int | 55 | int | |
@@ -68,27 +68,27 @@ main(int argc, char **argv) | @@ -68,27 +68,27 @@ main(int argc, char **argv) | |||
68 | } | 68 | } | |
69 | argc -= optind; | 69 | argc -= optind; | |
70 | argv += optind; | 70 | argv += optind; | |
71 | 71 | |||
72 | if (argc != 1 && argc != 2) | 72 | if (argc != 1 && argc != 2) | |
73 | usage(); | 73 | usage(); | |
74 | 74 | |||
75 | if (**argv == '\0') { | 75 | if (**argv == '\0') { | |
76 | (void)printf("\n"); | 76 | (void)printf("\n"); | |
77 | exit(0); | 77 | exit(0); | |
78 | } | 78 | } | |
79 | if ((p = basename(*argv)) == NULL) | 79 | if ((p = basename(*argv)) == NULL) | |
80 | err(1, "%s", *argv); | 80 | err(1, "%s", *argv); | |
81 | if (*++argv != '\0') { | 81 | if (*++argv != NULL) { | |
82 | int suffixlen, stringlen, off; | 82 | int suffixlen, stringlen, off; | |
83 | 83 | |||
84 | suffixlen = strlen(*argv); | 84 | suffixlen = strlen(*argv); | |
85 | stringlen = strlen(p); | 85 | stringlen = strlen(p); | |
86 | 86 | |||
87 | if (suffixlen < stringlen) { | 87 | if (suffixlen < stringlen) { | |
88 | off = stringlen - suffixlen; | 88 | off = stringlen - suffixlen; | |
89 | if (strcmp(p + off, *argv) == 0) | 89 | if (strcmp(p + off, *argv) == 0) | |
90 | p[off] = '\0'; | 90 | p[off] = '\0'; | |
91 | } | 91 | } | |
92 | } | 92 | } | |
93 | (void)printf("%s\n", p); | 93 | (void)printf("%s\n", p); | |
94 | exit(0); | 94 | exit(0); |
--- src/usr.bin/gcore/gcore.c 2008/04/28 20:24:13 1.11
+++ src/usr.bin/gcore/gcore.c 2019/02/01 08:29:04 1.12
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: gcore.c,v 1.11 2008/04/28 20:24:13 martin Exp $ */ | 1 | /* $NetBSD: gcore.c,v 1.12 2019/02/01 08:29:04 mrg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2003 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2003 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 Christos Zoulas. | 8 | * by Christos Zoulas. | |
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. | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
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 | __RCSID("$NetBSD: gcore.c,v 1.11 2008/04/28 20:24:13 martin Exp $"); | 33 | __RCSID("$NetBSD: gcore.c,v 1.12 2019/02/01 08:29:04 mrg Exp $"); | |
34 | 34 | |||
35 | #include <sys/types.h> | 35 | #include <sys/types.h> | |
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/time.h> | 37 | #include <sys/time.h> | |
38 | #include <sys/ptrace.h> | 38 | #include <sys/ptrace.h> | |
39 | #include <sys/proc.h> | 39 | #include <sys/proc.h> | |
40 | #include <sys/wait.h> | 40 | #include <sys/wait.h> | |
41 | 41 | |||
42 | #include <stdio.h> | 42 | #include <stdio.h> | |
43 | #include <string.h> | 43 | #include <string.h> | |
44 | #include <err.h> | 44 | #include <err.h> | |
45 | #include <limits.h> | 45 | #include <limits.h> | |
46 | #include <stdlib.h> | 46 | #include <stdlib.h> | |
@@ -78,27 +78,27 @@ main(int argc, char **argv) | @@ -78,27 +78,27 @@ main(int argc, char **argv) | |||
78 | } | 78 | } | |
79 | 79 | |||
80 | if (optind == argc) | 80 | if (optind == argc) | |
81 | usage(); | 81 | usage(); | |
82 | 82 | |||
83 | for (c = optind; c < argc; c++) { | 83 | for (c = optind; c < argc; c++) { | |
84 | char *ep; | 84 | char *ep; | |
85 | u_long lval; | 85 | u_long lval; | |
86 | int status, serrno; | 86 | int status, serrno; | |
87 | pid_t pid, cpid; | 87 | pid_t pid, cpid; | |
88 | 88 | |||
89 | errno = 0; | 89 | errno = 0; | |
90 | lval = strtoul(argv[c], &ep, 0); | 90 | lval = strtoul(argv[c], &ep, 0); | |
91 | if (argv[c] == '\0' || *ep) | 91 | if (argv[c] == NULL || *ep) | |
92 | errx(1, "`%s' is not a number.", argv[c]); | 92 | errx(1, "`%s' is not a number.", argv[c]); | |
93 | 93 | |||
94 | if (errno == ERANGE && lval == ULONG_MAX) | 94 | if (errno == ERANGE && lval == ULONG_MAX) | |
95 | err(1, "Pid `%s'", argv[c]); | 95 | err(1, "Pid `%s'", argv[c]); | |
96 | 96 | |||
97 | pid = (pid_t)lval; | 97 | pid = (pid_t)lval; | |
98 | 98 | |||
99 | if (ptrace(PT_ATTACH, pid, 0, 0) == -1) | 99 | if (ptrace(PT_ATTACH, pid, 0, 0) == -1) | |
100 | err(1, "ptrace(PT_ATTACH) to %lu failed", lval); | 100 | err(1, "ptrace(PT_ATTACH) to %lu failed", lval); | |
101 | 101 | |||
102 | if ((cpid = waitpid(pid, &status, 0)) != pid) { | 102 | if ((cpid = waitpid(pid, &status, 0)) != pid) { | |
103 | serrno = errno; | 103 | serrno = errno; | |
104 | (void)ptrace(PT_DETACH, pid, (void *)1, 0); | 104 | (void)ptrace(PT_DETACH, pid, (void *)1, 0); |
--- src/usr.bin/mail/mime_attach.c 2017/11/09 20:27:50 1.19
+++ src/usr.bin/mail/mime_attach.c 2019/02/01 08:29:04 1.20
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: mime_attach.c,v 1.19 2017/11/09 20:27:50 christos Exp $ */ | 1 | /* $NetBSD: mime_attach.c,v 1.20 2019/02/01 08:29:04 mrg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2006 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2006 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 Anon Ymous. | 8 | * by Anon Ymous. | |
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. | |
@@ -23,27 +23,27 @@ | @@ -23,27 +23,27 @@ | |||
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 | #ifdef MIME_SUPPORT | 32 | #ifdef MIME_SUPPORT | |
33 | 33 | |||
34 | #include <sys/cdefs.h> | 34 | #include <sys/cdefs.h> | |
35 | #ifndef __lint__ | 35 | #ifndef __lint__ | |
36 | __RCSID("$NetBSD: mime_attach.c,v 1.19 2017/11/09 20:27:50 christos Exp $"); | 36 | __RCSID("$NetBSD: mime_attach.c,v 1.20 2019/02/01 08:29:04 mrg Exp $"); | |
37 | #endif /* not __lint__ */ | 37 | #endif /* not __lint__ */ | |
38 | 38 | |||
39 | #include <assert.h> | 39 | #include <assert.h> | |
40 | #include <err.h> | 40 | #include <err.h> | |
41 | #include <fcntl.h> | 41 | #include <fcntl.h> | |
42 | #include <libgen.h> | 42 | #include <libgen.h> | |
43 | #include <magic.h> | 43 | #include <magic.h> | |
44 | #include <signal.h> | 44 | #include <signal.h> | |
45 | #include <stdio.h> | 45 | #include <stdio.h> | |
46 | #include <stdlib.h> | 46 | #include <stdlib.h> | |
47 | #include <string.h> | 47 | #include <string.h> | |
48 | #include <unistd.h> | 48 | #include <unistd.h> | |
49 | #include <util.h> | 49 | #include <util.h> | |
@@ -1008,27 +1008,27 @@ mime_attach_optargs(struct name *optargs | @@ -1008,27 +1008,27 @@ mime_attach_optargs(struct name *optargs | |||
1008 | expand_optargs = value(ENAME_MIME_ATTACH_LIST); | 1008 | expand_optargs = value(ENAME_MIME_ATTACH_LIST); | |
1009 | attach_num = 1; | 1009 | attach_num = 1; | |
1010 | ap = NULL; | 1010 | ap = NULL; | |
1011 | attach = NULL; | 1011 | attach = NULL; | |
1012 | for (np = optargs; np; np = np->n_flink) { | 1012 | for (np = optargs; np; np = np->n_flink) { | |
1013 | char *argv[MAXARGC]; | 1013 | char *argv[MAXARGC]; | |
1014 | int argc; | 1014 | int argc; | |
1015 | int i; | 1015 | int i; | |
1016 | 1016 | |||
1017 | if (expand_optargs != NULL) | 1017 | if (expand_optargs != NULL) | |
1018 | argc = getrawlist(np->n_name, | 1018 | argc = getrawlist(np->n_name, | |
1019 | argv, (int)__arraycount(argv)); | 1019 | argv, (int)__arraycount(argv)); | |
1020 | else { | 1020 | else { | |
1021 | if (np->n_name == '\0') | 1021 | if (np->n_name == NULL) | |
1022 | argc = 0; | 1022 | argc = 0; | |
1023 | else { | 1023 | else { | |
1024 | argc = 1; | 1024 | argc = 1; | |
1025 | argv[0] = np->n_name; | 1025 | argv[0] = np->n_name; | |
1026 | } | 1026 | } | |
1027 | argv[argc] = NULL;/* be consistent with getrawlist() */ | 1027 | argv[argc] = NULL;/* be consistent with getrawlist() */ | |
1028 | } | 1028 | } | |
1029 | for (i = 0; i < argc; i++) { | 1029 | for (i = 0; i < argc; i++) { | |
1030 | struct attachment *ap2; | 1030 | struct attachment *ap2; | |
1031 | char *filename; | 1031 | char *filename; | |
1032 | 1032 | |||
1033 | if (argv[i][0] == '/') /* an absolute path */ | 1033 | if (argv[i][0] == '/') /* an absolute path */ | |
1034 | (void)easprintf(&filename, "%s", argv[i]); | 1034 | (void)easprintf(&filename, "%s", argv[i]); |
--- src/usr.bin/tabs/tabs.c 2011/09/16 15:39:29 1.4
+++ src/usr.bin/tabs/tabs.c 2019/02/01 08:29:04 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: tabs.c,v 1.4 2011/09/16 15:39:29 joerg Exp $ */ | 1 | /* $NetBSD: tabs.c,v 1.5 2019/02/01 08:29:04 mrg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2008 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 Roy Marples. | 8 | * by Roy Marples. | |
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. | |
@@ -23,27 +23,27 @@ | @@ -23,27 +23,27 @@ | |||
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 | __COPYRIGHT("@(#) Copyright (c) 2008 \ | 34 | __COPYRIGHT("@(#) Copyright (c) 2008 \ | |
35 | The NetBSD Foundation, inc. All rights reserved."); | 35 | The NetBSD Foundation, inc. All rights reserved."); | |
36 | __RCSID("$NetBSD: tabs.c,v 1.4 2011/09/16 15:39:29 joerg Exp $"); | 36 | __RCSID("$NetBSD: tabs.c,v 1.5 2019/02/01 08:29:04 mrg Exp $"); | |
37 | #endif /* not lint */ | 37 | #endif /* not lint */ | |
38 | 38 | |||
39 | #include <sys/ioctl.h> | 39 | #include <sys/ioctl.h> | |
40 | #include <sys/types.h> | 40 | #include <sys/types.h> | |
41 | 41 | |||
42 | #include <ctype.h> | 42 | #include <ctype.h> | |
43 | #include <err.h> | 43 | #include <err.h> | |
44 | #include <errno.h> | 44 | #include <errno.h> | |
45 | #include <stdio.h> | 45 | #include <stdio.h> | |
46 | #include <stdlib.h> | 46 | #include <stdlib.h> | |
47 | #include <string.h> | 47 | #include <string.h> | |
48 | #include <term.h> | 48 | #include <term.h> | |
49 | #include <unistd.h> | 49 | #include <unistd.h> | |
@@ -102,27 +102,27 @@ main(int argc, char **argv) | @@ -102,27 +102,27 @@ main(int argc, char **argv) | |||
102 | errx(EXIT_FAILURE, | 102 | errx(EXIT_FAILURE, | |
103 | "%s: invalid margin", arg); | 103 | "%s: invalid margin", arg); | |
104 | } | 104 | } | |
105 | continue; | 105 | continue; | |
106 | } | 106 | } | |
107 | if (argv[i][0] != '-') { | 107 | if (argv[i][0] != '-') { | |
108 | tabs = argv[i]; | 108 | tabs = argv[i]; | |
109 | break; | 109 | break; | |
110 | } | 110 | } | |
111 | arg = argv[i] + 1; | 111 | arg = argv[i] + 1; | |
112 | if (arg[0] == '\0') | 112 | if (arg[0] == '\0') | |
113 | usage(); | 113 | usage(); | |
114 | if (arg[0] == '-' && arg[1] == '\0') { | 114 | if (arg[0] == '-' && arg[1] == '\0') { | |
115 | if (argv[i + 1] != '\0') | 115 | if (argv[i + 1] != NULL) | |
116 | tabs = argv[i + 1]; | 116 | tabs = argv[i + 1]; | |
117 | break; | 117 | break; | |
118 | } | 118 | } | |
119 | if (arg[0] == 'T' && arg[1] == '\0') { | 119 | if (arg[0] == 'T' && arg[1] == '\0') { | |
120 | term = argv[++i]; | 120 | term = argv[++i]; | |
121 | if (term == NULL) | 121 | if (term == NULL) | |
122 | usage(); | 122 | usage(); | |
123 | continue; | 123 | continue; | |
124 | } | 124 | } | |
125 | if (isdigit((int)arg[0])) { | 125 | if (isdigit((int)arg[0])) { | |
126 | if (arg[1] != '\0') | 126 | if (arg[1] != '\0') | |
127 | errx(EXIT_FAILURE, | 127 | errx(EXIT_FAILURE, | |
128 | "%s: invalid increament", arg); | 128 | "%s: invalid increament", arg); |
--- src/usr.bin/tip/acu.c 2011/09/06 18:33:01 1.16
+++ src/usr.bin/tip/acu.c 2019/02/01 08:29:04 1.17
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: acu.c,v 1.16 2011/09/06 18:33:01 joerg Exp $ */ | 1 | /* $NetBSD: acu.c,v 1.17 2019/02/01 08:29:04 mrg Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1983, 1993 | 4 | * Copyright (c) 1983, 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. | |
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
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 | #if 0 | 34 | #if 0 | |
35 | static char sccsid[] = "@(#)acu.c 8.1 (Berkeley) 6/6/93"; | 35 | static char sccsid[] = "@(#)acu.c 8.1 (Berkeley) 6/6/93"; | |
36 | #endif | 36 | #endif | |
37 | __RCSID("$NetBSD: acu.c,v 1.16 2011/09/06 18:33:01 joerg Exp $"); | 37 | __RCSID("$NetBSD: acu.c,v 1.17 2019/02/01 08:29:04 mrg Exp $"); | |
38 | #endif /* not lint */ | 38 | #endif /* not lint */ | |
39 | 39 | |||
40 | #include "tip.h" | 40 | #include "tip.h" | |
41 | 41 | |||
42 | static acu_t *acu = NULL; | 42 | static acu_t *acu = NULL; | |
43 | static int conflag; | 43 | static int conflag; | |
44 | static jmp_buf jmpbuf; | 44 | static jmp_buf jmpbuf; | |
45 | 45 | |||
46 | __dead static void acuabort(int); | 46 | __dead static void acuabort(int); | |
47 | static acu_t *acutype(char *); | 47 | static acu_t *acutype(char *); | |
48 | 48 | |||
49 | /* | 49 | /* | |
50 | * Establish connection for tip | 50 | * Establish connection for tip | |
@@ -173,18 +173,18 @@ disconnect(const char *reason) | @@ -173,18 +173,18 @@ disconnect(const char *reason) | |||
173 | static void | 173 | static void | |
174 | acuabort(int s) | 174 | acuabort(int s) | |
175 | { | 175 | { | |
176 | 176 | |||
177 | (void)signal(s, SIG_IGN); | 177 | (void)signal(s, SIG_IGN); | |
178 | longjmp(jmpbuf, 1); | 178 | longjmp(jmpbuf, 1); | |
179 | } | 179 | } | |
180 | 180 | |||
181 | static acu_t * | 181 | static acu_t * | |
182 | acutype(char *s) | 182 | acutype(char *s) | |
183 | { | 183 | { | |
184 | acu_t *p; | 184 | acu_t *p; | |
185 | 185 | |||
186 | for (p = acutable; p->acu_name != '\0'; p++) | 186 | for (p = acutable; p->acu_name != NULL; p++) | |
187 | if (!strcmp(s, p->acu_name)) | 187 | if (!strcmp(s, p->acu_name)) | |
188 | return (p); | 188 | return (p); | |
189 | return (NULL); | 189 | return (NULL); | |
190 | } | 190 | } |
--- src/usr.sbin/fwctl/fwcontrol.c 2011/10/17 16:50:47 1.16
+++ src/usr.sbin/fwctl/fwcontrol.c 2019/02/01 08:29:04 1.17
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: fwcontrol.c,v 1.16 2011/10/17 16:50:47 mbalmer Exp $ */ | 1 | /* $NetBSD: fwcontrol.c,v 1.17 2019/02/01 08:29:04 mrg Exp $ */ | |
2 | /* | 2 | /* | |
3 | * Copyright (C) 2002 | 3 | * Copyright (C) 2002 | |
4 | * Hidetoshi Shimokawa. All rights reserved. | 4 | * Hidetoshi Shimokawa. All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * 3. All advertising materials mentioning features or use of this software | 14 | * 3. All advertising materials mentioning features or use of this software | |
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
33 | * SUCH DAMAGE. | 33 | * SUCH DAMAGE. | |
34 | */ | 34 | */ | |
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | //__FBSDID("$FreeBSD: src/usr.sbin/fwcontrol/fwcontrol.c,v 1.23 2006/10/26 22:33:38 imp Exp $"); | 36 | //__FBSDID("$FreeBSD: src/usr.sbin/fwcontrol/fwcontrol.c,v 1.23 2006/10/26 22:33:38 imp Exp $"); | |
37 | __RCSID("$NetBSD: fwcontrol.c,v 1.16 2011/10/17 16:50:47 mbalmer Exp $"); | 37 | __RCSID("$NetBSD: fwcontrol.c,v 1.17 2019/02/01 08:29:04 mrg Exp $"); | |
38 | 38 | |||
39 | #include <sys/param.h> | 39 | #include <sys/param.h> | |
40 | #include <sys/malloc.h> | 40 | #include <sys/malloc.h> | |
41 | #include <sys/types.h> | 41 | #include <sys/types.h> | |
42 | #include <sys/sysctl.h> | 42 | #include <sys/sysctl.h> | |
43 | #include <sys/socket.h> | 43 | #include <sys/socket.h> | |
44 | #include <sys/ioctl.h> | 44 | #include <sys/ioctl.h> | |
45 | #include <sys/errno.h> | 45 | #include <sys/errno.h> | |
46 | #include "eui64.h" | 46 | #include "eui64.h" | |
47 | #include <dev/ieee1394/firewire.h> | 47 | #include <dev/ieee1394/firewire.h> | |
48 | #include <dev/ieee1394/iec13213.h> | 48 | #include <dev/ieee1394/iec13213.h> | |
49 | #include <dev/ieee1394/fwphyreg.h> | 49 | #include <dev/ieee1394/fwphyreg.h> | |
50 | #include <dev/ieee1394/iec68113.h> | 50 | #include <dev/ieee1394/iec68113.h> | |
@@ -107,27 +107,27 @@ get_dev(int fd, struct fw_devlstreq *dat | @@ -107,27 +107,27 @@ get_dev(int fd, struct fw_devlstreq *dat | |||
107 | if (ioctl(fd, FW_GDEVLST, data) < 0) | 107 | if (ioctl(fd, FW_GDEVLST, data) < 0) | |
108 | err(EX_IOERR, "%s: ioctl", __func__); | 108 | err(EX_IOERR, "%s: ioctl", __func__); | |
109 | } | 109 | } | |
110 | 110 | |||
111 | static int | 111 | static int | |
112 | str2node(int fd, const char *nodestr) | 112 | str2node(int fd, const char *nodestr) | |
113 | { | 113 | { | |
114 | struct eui64 eui, tmpeui; | 114 | struct eui64 eui, tmpeui; | |
115 | struct fw_devlstreq *data; | 115 | struct fw_devlstreq *data; | |
116 | char *endptr; | 116 | char *endptr; | |
117 | int i; | 117 | int i; | |
118 | long node; | 118 | long node; | |
119 | 119 | |||
120 | if (nodestr == '\0') | 120 | if (nodestr == NULL) | |
121 | return -1; | 121 | return -1; | |
122 | 122 | |||
123 | /* | 123 | /* | |
124 | * Deal with classic node specifications. | 124 | * Deal with classic node specifications. | |
125 | */ | 125 | */ | |
126 | node = strtol(nodestr, &endptr, 0); | 126 | node = strtol(nodestr, &endptr, 0); | |
127 | if (*endptr == '\0') | 127 | if (*endptr == '\0') | |
128 | goto gotnode; | 128 | goto gotnode; | |
129 | 129 | |||
130 | /* | 130 | /* | |
131 | * Try to get an eui and match it against available nodes. | 131 | * Try to get an eui and match it against available nodes. | |
132 | */ | 132 | */ | |
133 | if (eui64_hostton(nodestr, &eui) != 0 && eui64_aton(nodestr, &eui) != 0) | 133 | if (eui64_hostton(nodestr, &eui) != 0 && eui64_aton(nodestr, &eui) != 0) |