1 /* pidwait.c - wait for child to exit */
3 static char ident[] = "@(#)$Id: pidwait.c,v 1.10 1992/12/15 00:20:22 jromine Exp $";
9 #if defined (BSD42) || defined (SVR4)
14 int pidwait (id, sigsok)
19 TYPESIG (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
20 #if defined(BSD42) && !defined(WAITINT)
26 if (sigsok == NOTOK) {
27 #ifdef notdef /* I don't see why to trap these... */
28 hstat = signal (SIGHUP, SIG_IGN);
29 tstat = signal (SIGTERM, SIG_IGN);
31 istat = signal (SIGINT, SIG_IGN);
32 qstat = signal (SIGQUIT, SIG_IGN);
36 pid = waitpid (id, &status, WUNTRACED);
38 while ((pid = wait (&status)) != NOTOK && pid != id)
42 if (sigsok == NOTOK) {
44 (void) signal (SIGHUP, hstat);
45 (void) signal (SIGTERM, tstat);
47 (void) signal (SIGINT, istat);
48 (void) signal (SIGQUIT, qstat);
51 #if defined(BSD42) && !defined(WAITINT)
52 return (pid == NOTOK ? NOTOK : status.w_status);
54 return (pid == NOTOK ? NOTOK : status);