kill.c (26465) | kill.c (28554) |
---|---|
1/* 2 * Copyright (c) 1988, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 1988, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $Id: kill.c,v 1.7 1997/06/03 06:24:50 charnier Exp $ | 33 * $Id: kill.c,v 1.8 1997/06/06 06:36:20 charnier Exp $ |
34 */ 35 36#ifndef lint 37static char const copyright[] = 38"@(#) Copyright (c) 1988, 1993, 1994\n\ 39 The Regents of the University of California. All rights reserved.\n"; 40#endif /* not lint */ 41 --- 31 unchanged lines hidden (view full) --- 73 if (!strcmp(*argv, "-l")) { 74 argc--, argv++; 75 if (argc > 1) 76 usage(); 77 if (argc == 1) { 78 if (!isdigit(**argv)) 79 usage(); 80 numsig = strtol(*argv, &ep, 10); | 34 */ 35 36#ifndef lint 37static char const copyright[] = 38"@(#) Copyright (c) 1988, 1993, 1994\n\ 39 The Regents of the University of California. All rights reserved.\n"; 40#endif /* not lint */ 41 --- 31 unchanged lines hidden (view full) --- 73 if (!strcmp(*argv, "-l")) { 74 argc--, argv++; 75 if (argc > 1) 76 usage(); 77 if (argc == 1) { 78 if (!isdigit(**argv)) 79 usage(); 80 numsig = strtol(*argv, &ep, 10); |
81 if (!*argv || *ep) | 81 if (!**argv || *ep) |
82 errx(1, "illegal signal number: %s", *argv); 83 if (numsig >= 128) 84 numsig -= 128; 85 if (numsig <= 0 || numsig >= NSIG) 86 nosig(*argv); 87 printf("%s\n", sys_signame[numsig]); 88 exit(0); 89 } --- 15 unchanged lines hidden (view full) --- 105 argc--, argv++; 106 } else if (**argv == '-') { 107 ++*argv; 108 if (isalpha(**argv)) { 109 if ((numsig = signame_to_signum(*argv)) < 0) 110 nosig(*argv); 111 } else if (isdigit(**argv)) { 112 numsig = strtol(*argv, &ep, 10); | 82 errx(1, "illegal signal number: %s", *argv); 83 if (numsig >= 128) 84 numsig -= 128; 85 if (numsig <= 0 || numsig >= NSIG) 86 nosig(*argv); 87 printf("%s\n", sys_signame[numsig]); 88 exit(0); 89 } --- 15 unchanged lines hidden (view full) --- 105 argc--, argv++; 106 } else if (**argv == '-') { 107 ++*argv; 108 if (isalpha(**argv)) { 109 if ((numsig = signame_to_signum(*argv)) < 0) 110 nosig(*argv); 111 } else if (isdigit(**argv)) { 112 numsig = strtol(*argv, &ep, 10); |
113 if (!*argv || *ep) | 113 if (!**argv || *ep) |
114 errx(1, "illegal signal number: %s", *argv); 115 if (numsig < 0 || numsig >= NSIG) 116 nosig(*argv); 117 } else 118 nosig(*argv); 119 argc--, argv++; 120 } 121 122 if (argc == 0) 123 usage(); 124 125 for (errors = 0; argc; argc--, argv++) { 126 pid = strtol(*argv, &ep, 10); | 114 errx(1, "illegal signal number: %s", *argv); 115 if (numsig < 0 || numsig >= NSIG) 116 nosig(*argv); 117 } else 118 nosig(*argv); 119 argc--, argv++; 120 } 121 122 if (argc == 0) 123 usage(); 124 125 for (errors = 0; argc; argc--, argv++) { 126 pid = strtol(*argv, &ep, 10); |
127 if (!*argv || *ep) { | 127 if (!**argv || *ep) { |
128 warnx("illegal process id: %s", *argv); 129 errors = 1; 130 } else if (kill(pid, numsig) == -1) { 131 warn("%s", *argv); 132 errors = 1; 133 } 134 } 135 --- 54 unchanged lines hidden --- | 128 warnx("illegal process id: %s", *argv); 129 errors = 1; 130 } else if (kill(pid, numsig) == -1) { 131 warn("%s", *argv); 132 errors = 1; 133 } 134 } 135 --- 54 unchanged lines hidden --- |