]> diplodocus.org Git - nmh/blobdiff - sbr/pidwait.c
In test-curses, use termcap codes if terminfo capabilities
[nmh] / sbr / pidwait.c
index ef42e1aa3d881523013fcc5d3776cbcb9cdb516e..a6dc27f9c2f4a2bfa2cab21dcf030eceb334bcc1 100644 (file)
@@ -9,12 +9,6 @@
 
 #include <h/mh.h>
 #include <h/signals.h>
 
 #include <h/mh.h>
 #include <h/signals.h>
-#include <errno.h>
-#include <signal.h>
-
-#ifdef HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
 
 int
 pidwait (pid_t id, int sigsok)
 
 int
 pidwait (pid_t id, int sigsok)
@@ -22,11 +16,7 @@ pidwait (pid_t id, int sigsok)
     pid_t pid;
     SIGNAL_HANDLER istat = NULL, qstat = NULL;
 
     pid_t pid;
     SIGNAL_HANDLER istat = NULL, qstat = NULL;
 
-#ifdef HAVE_UNION_WAIT
-    union wait status;
-#else
     int status;
     int status;
-#endif
 
     if (sigsok == -1) {
        /* ignore a couple of signals */
 
     if (sigsok == -1) {
        /* ignore a couple of signals */
@@ -34,13 +24,8 @@ pidwait (pid_t id, int sigsok)
        qstat = SIGNAL (SIGQUIT, SIG_IGN);
     }
 
        qstat = SIGNAL (SIGQUIT, SIG_IGN);
     }
 
-#ifdef HAVE_WAITPID
     while ((pid = waitpid(id, &status, 0)) == -1 && errno == EINTR)
        ;
     while ((pid = waitpid(id, &status, 0)) == -1 && errno == EINTR)
        ;
-#else
-    while ((pid = wait(&status)) != -1 && pid != id)
-       continue;
-#endif
 
     if (sigsok == -1) {
        /* reset the signal handlers */
 
     if (sigsok == -1) {
        /* reset the signal handlers */
@@ -48,9 +33,5 @@ pidwait (pid_t id, int sigsok)
        SIGNAL (SIGQUIT, qstat);
     }
 
        SIGNAL (SIGQUIT, qstat);
     }
 
-#ifdef HAVE_UNION_WAIT
-    return (pid == -1 ? -1 : status.w_status);
-#else
     return (pid == -1 ? -1 : status);
     return (pid == -1 ? -1 : status);
-#endif
 }
 }