| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: jobs.c,v 1.108 2020/08/20 23:03:17 kre Exp $ */ | | 1 | /* $NetBSD: jobs.c,v 1.109 2020/08/30 19:45:05 kre Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1991, 1993 | | 4 | * Copyright (c) 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 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Kenneth Almquist. | | 8 | * Kenneth Almquist. |
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. |
| @@ -27,27 +27,27 @@ | | | @@ -27,27 +27,27 @@ |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | * SUCH DAMAGE. | | 32 | * SUCH DAMAGE. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | #include <sys/cdefs.h> | | 35 | #include <sys/cdefs.h> |
36 | #ifndef lint | | 36 | #ifndef lint |
37 | #if 0 | | 37 | #if 0 |
38 | static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95"; | | 38 | static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95"; |
39 | #else | | 39 | #else |
40 | __RCSID("$NetBSD: jobs.c,v 1.108 2020/08/20 23:03:17 kre Exp $"); | | 40 | __RCSID("$NetBSD: jobs.c,v 1.109 2020/08/30 19:45:05 kre Exp $"); |
41 | #endif | | 41 | #endif |
42 | #endif /* not lint */ | | 42 | #endif /* not lint */ |
43 | | | 43 | |
44 | #include <stdio.h> | | 44 | #include <stdio.h> |
45 | #include <fcntl.h> | | 45 | #include <fcntl.h> |
46 | #include <signal.h> | | 46 | #include <signal.h> |
47 | #include <errno.h> | | 47 | #include <errno.h> |
48 | #include <unistd.h> | | 48 | #include <unistd.h> |
49 | #include <stdlib.h> | | 49 | #include <stdlib.h> |
50 | #include <paths.h> | | 50 | #include <paths.h> |
51 | #include <sys/types.h> | | 51 | #include <sys/types.h> |
52 | #include <sys/param.h> | | 52 | #include <sys/param.h> |
53 | #ifdef BSD | | 53 | #ifdef BSD |
| @@ -961,27 +961,27 @@ jobidcmd(int argc, char **argv) | | | @@ -961,27 +961,27 @@ jobidcmd(int argc, char **argv) |
961 | return 0; | | 961 | return 0; |
962 | } | | 962 | } |
963 | | | 963 | |
964 | int | | 964 | int |
965 | getjobpgrp(const char *name) | | 965 | getjobpgrp(const char *name) |
966 | { | | 966 | { |
967 | struct job *jp; | | 967 | struct job *jp; |
968 | | | 968 | |
969 | if (jobs_invalid) | | 969 | if (jobs_invalid) |
970 | error("No such job: %s", name); | | 970 | error("No such job: %s", name); |
971 | jp = getjob(name, 1); | | 971 | jp = getjob(name, 1); |
972 | if (jp == 0) | | 972 | if (jp == 0) |
973 | return 0; | | 973 | return 0; |
974 | return -jp->ps[0].pid; | | 974 | return -jp->pgrp; |
975 | } | | 975 | } |
976 | | | 976 | |
977 | /* | | 977 | /* |
978 | * Convert a job name to a job structure. | | 978 | * Convert a job name to a job structure. |
979 | */ | | 979 | */ |
980 | | | 980 | |
981 | STATIC struct job * | | 981 | STATIC struct job * |
982 | getjob(const char *name, int noerror) | | 982 | getjob(const char *name, int noerror) |
983 | { | | 983 | { |
984 | int jobno = -1; | | 984 | int jobno = -1; |
985 | struct job *jp; | | 985 | struct job *jp; |
986 | int pid; | | 986 | int pid; |
987 | int i; | | 987 | int i; |