| 1 | #ifndef lint |
| 2 | static char *sccsid = "@(#)wwchild.c 2.1.1.1 83/08/09"; |
| 3 | #endif |
| 4 | |
| 5 | #include "ww.h" |
| 6 | #include <sys/wait.h> |
| 7 | |
| 8 | wwchild() |
| 9 | { |
| 10 | register struct ww **wp; |
| 11 | union wait w; |
| 12 | int pid; |
| 13 | |
| 14 | while ((pid = wait3(&w, WNOHANG|WUNTRACED, (struct rusage *)0)) > 0) { |
| 15 | for (wp = wwindex; wp < &wwindex[NWW]; wp++) { |
| 16 | if (*wp && (*wp)->ww_state == WWS_HASPROC |
| 17 | && (*wp)->ww_pid == pid) { |
| 18 | (*wp)->ww_state = WWS_DEAD; |
| 19 | /* |
| 20 | (void) wwprintf(curwin, |
| 21 | "\r\n%d: Died\r\n", pid); |
| 22 | */ |
| 23 | break; |
| 24 | } |
| 25 | } |
| 26 | /* |
| 27 | if (wp >= &wwindex[NWW]) |
| 28 | (void) wwprintf(curwin, "\r\n%d: No such child\r\n", pid); |
| 29 | */ |
| 30 | } |
| 31 | } |