]> diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/sbr/RCS/pidwait.c,v
Exposed a bunch of switches that are now documented.
[nmh] / docs / historical / mh-6.8.5 / sbr / RCS / pidwait.c,v
1 head 1.10;
2 access;
3 symbols;
4 locks; strict;
5 comment @ * @;
6
7
8 1.10
9 date 92.12.15.00.20.22; author jromine; state Exp;
10 branches;
11 next 1.9;
12
13 1.9
14 date 92.12.14.17.10.58; author jromine; state Exp;
15 branches;
16 next 1.8;
17
18 1.8
19 date 92.11.23.22.56.09; author jromine; state Exp;
20 branches;
21 next 1.7;
22
23 1.7
24 date 92.11.11.22.04.30; author jromine; state Exp;
25 branches;
26 next 1.6;
27
28 1.6
29 date 92.05.19.20.57.43; author jromine; state Exp;
30 branches;
31 next 1.5;
32
33 1.5
34 date 92.01.29.23.57.28; author jromine; state Exp;
35 branches;
36 next 1.4;
37
38 1.4
39 date 90.04.05.15.31.19; author sources; state Exp;
40 branches;
41 next 1.3;
42
43 1.3
44 date 90.04.05.14.45.34; author sources; state Exp;
45 branches;
46 next 1.2;
47
48 1.2
49 date 90.02.05.14.23.23; author sources; state Exp;
50 branches;
51 next 1.1;
52
53 1.1
54 date 90.02.05.14.23.17; author sources; state Exp;
55 branches;
56 next ;
57
58
59 desc
60 @@
61
62
63 1.10
64 log
65 @endif sugar
66 @
67 text
68 @/* pidwait.c - wait for child to exit */
69 #ifndef lint
70 static char ident[] = "@@(#)$Id: pidwait.c,v 1.9 1992/12/14 17:10:58 jromine Exp jromine $";
71 #endif /* lint */
72
73 #include "../h/mh.h"
74 #include <signal.h>
75 #include <stdio.h>
76 #if defined (BSD42) || defined (SVR4)
77 #include <sys/wait.h>
78 #endif
79
80
81 int pidwait (id, sigsok)
82 register int id,
83 sigsok;
84 {
85 register int pid;
86 TYPESIG (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
87 #if defined(BSD42) && !defined(WAITINT)
88 union wait status;
89 #else
90 int status;
91 #endif
92
93 if (sigsok == NOTOK) {
94 #ifdef notdef /* I don't see why to trap these... */
95 hstat = signal (SIGHUP, SIG_IGN);
96 tstat = signal (SIGTERM, SIG_IGN);
97 #endif
98 istat = signal (SIGINT, SIG_IGN);
99 qstat = signal (SIGQUIT, SIG_IGN);
100 }
101
102 #ifdef SVR4
103 pid = waitpid (id, &status, WUNTRACED);
104 #else
105 while ((pid = wait (&status)) != NOTOK && pid != id)
106 continue;
107 #endif
108
109 if (sigsok == NOTOK) {
110 #ifdef notdef
111 (void) signal (SIGHUP, hstat);
112 (void) signal (SIGTERM, tstat);
113 #endif
114 (void) signal (SIGINT, istat);
115 (void) signal (SIGQUIT, qstat);
116 }
117
118 #if defined(BSD42) && !defined(WAITINT)
119 return (pid == NOTOK ? NOTOK : status.w_status);
120 #else
121 return (pid == NOTOK ? NOTOK : status);
122 #endif
123 }
124 @
125
126
127 1.9
128 log
129 @WAITINT ifdef
130 @
131 text
132 @d3 2
133 a4 2
134 static char ident[] = "@@(#)$Id: pidwait.c,v 1.8 1992/11/23 22:56:09 jromine Exp jromine $";
135 #endif lint
136 @
137
138
139 1.8
140 log
141 @fix arg order in waitpid()
142 @
143 text
144 @d3 1
145 a3 1
146 static char ident[] = "@@(#)$Id: pidwait.c,v 1.7 1992/11/11 22:04:30 jromine Exp jromine $";
147 d20 3
148 a22 1
149 #ifndef BSD42
150 a23 2
151 #else
152 union wait status;
153 d51 3
154 a53 1
155 #ifndef BSD42
156 a54 2
157 #else
158 return (pid == NOTOK ? NOTOK : status.w_status);
159 @
160
161
162 1.7
163 log
164 @use union wait under BSD42 only
165 @
166 text
167 @d3 1
168 a3 1
169 static char ident[] = "@@(#)$Id: pidwait.c,v 1.6 1992/05/19 20:57:43 jromine Exp jromine $";
170 d9 1
171 a9 1
172 #ifdef BSD42
173 d36 1
174 a36 1
175 pid = waitpid (&status, id, 0);
176 @
177
178
179 1.6
180 log
181 @AIX
182 @
183 text
184 @d3 1
185 a3 1
186 static char ident[] = "@@(#)$Id: pidwait.c,v 1.5 1992/01/29 23:57:28 jromine Exp jromine $";
187 d11 1
188 a11 1
189 #endif BSD42
190 a19 3
191 #ifdef _AIX
192 #undef BSD42
193 #endif
194 d35 1
195 a35 1
196 #ifdef _AIX
197 @
198
199
200 1.5
201 log
202 @don't ignore HUP or TERM
203 @
204 text
205 @d3 1
206 a3 1
207 static char ident[] = "@@(#)$Id: pidwait.c,v 1.4 1990/04/05 15:31:19 sources Exp jromine $";
208 d20 3
209 d25 1
210 a25 1
211 #else BSD42
212 d27 1
213 a27 1
214 #endif BSD42
215 d38 3
216 d43 1
217 d56 1
218 a56 1
219 #else BSD42
220 d58 1
221 a58 1
222 #endif BSD42
223 @
224
225
226 1.4
227 log
228 @add ID
229 @
230 text
231 @d3 1
232 a3 1
233 static char ident[] = "@@(#)$Id:$";
234 d27 1
235 d29 2
236 a32 1
237 tstat = signal (SIGTERM, SIG_IGN);
238 d39 1
239 d41 2
240 a44 1
241 (void) signal (SIGTERM, tstat);
242 @
243
244
245 1.3
246 log
247 @add ID
248 @
249 text
250 @d3 1
251 a3 1
252 static char ident[] = "$Id:";
253 @
254
255
256 1.2
257 log
258 @*** empty log message ***
259 @
260 text
261 @d2 3
262 @
263
264
265 1.1
266 log
267 @Initial revision
268 @
269 text
270 @d16 1
271 a16 1
272 int (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
273 @