ANSI
[unix-history] / usr / src / usr.bin / window / wwchild.c
index d83c442..1f07150 100644 (file)
@@ -1,17 +1,22 @@
-#ifndef lint
-static char sccsid[] = "@(#)wwchild.c  3.6 %G%";
-#endif
-
 /*
 /*
- * Copyright (c) 1983 Regents of the University of California,
- * All rights reserved.  Redistribution permitted subject to
- * the terms of the Berkeley Software License Agreement.
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Edward Wang at The University of California, Berkeley.
+ *
+ * %sccs.include.redist.c%
  */
 
  */
 
+#ifndef lint
+static char sccsid[] = "@(#)wwchild.c  3.15 (Berkeley) %G%";
+#endif /* not lint */
+
 #include "ww.h"
 #include <sys/types.h>
 #include <sys/wait.h>
 
 #include "ww.h"
 #include <sys/types.h>
 #include <sys/wait.h>
 
+void
 wwchild()
 {
        extern errno;
 wwchild()
 {
        extern errno;
@@ -19,16 +24,22 @@ wwchild()
        register struct ww **wp;
        union wait w;
        int pid;
        register struct ww **wp;
        union wait w;
        int pid;
+       char collected = 0;
 
        olderrno = errno;
 
        olderrno = errno;
-       while ((pid = wait3(&w, WNOHANG|WUNTRACED, (struct rusage *)0)) > 0) {
+       while ((pid =
+           wait3((int *)&w, WNOHANG|WUNTRACED, (struct rusage *)0)) > 0) {
                for (wp = wwindex; wp < &wwindex[NWW]; wp++) {
                        if (*wp && (*wp)->ww_state == WWS_HASPROC
                            && (*wp)->ww_pid == pid) {
                                (*wp)->ww_state = WWS_DEAD;
                for (wp = wwindex; wp < &wwindex[NWW]; wp++) {
                        if (*wp && (*wp)->ww_state == WWS_HASPROC
                            && (*wp)->ww_pid == pid) {
                                (*wp)->ww_state = WWS_DEAD;
+                               collected = 1;
                                break;
                        }
                }
        }
        errno = olderrno;
                                break;
                        }
                }
        }
        errno = olderrno;
+       /* jump out of wwiomux when somebody dies */
+       if (collected)
+               wwsetintr();
 }
 }