From 9b39ed7b9416390758870edd85ae19dbee651312 Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 3 Jun 2002 23:13:11 +0000 Subject: Use POSIX macros for wait(2)-style status information instead of the deprecated 4.2/4.3BSD wait union. Fix some nearby pid_t/int confusion. --- usr.bin/rlogin/rlogin.c | 8 ++++---- usr.bin/script/script.c | 6 +++--- usr.bin/window/wwchild.c | 5 ++--- 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/rlogin/rlogin.c b/usr.bin/rlogin/rlogin.c index 5642066..edf908b 100644 --- a/usr.bin/rlogin/rlogin.c +++ b/usr.bin/rlogin/rlogin.c @@ -468,16 +468,16 @@ writeroob(int signo __unused) void catch_child(int signo __unused) { - union wait status; - int pid; + pid_t pid; + int status; for (;;) { - pid = wait3((int *)&status, WNOHANG|WUNTRACED, NULL); + pid = wait3(&status, WNOHANG|WUNTRACED, NULL); if (pid == 0) return; /* if the child (reader) dies, just quit */ if (pid < 0 || (pid == child && !WIFSTOPPED(status))) - done((int)(status.w_termsig | status.w_retcode)); + done(WTERMSIG(status) | WEXITSTATUS(status)); } /* NOTREACHED */ } diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index 0019a46..c589239 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -209,11 +209,11 @@ usage() void finish() { - int die, e, pid; - union wait status; + pid_t pid; + int die, e, status; die = e = 0; - while ((pid = wait3((int *)&status, WNOHANG, 0)) > 0) + while ((pid = wait3(&status, WNOHANG, 0)) > 0) if (pid == child) { die = 1; if (WIFEXITED(status)) diff --git a/usr.bin/window/wwchild.c b/usr.bin/window/wwchild.c index 8b82fac..3ff46ec 100644 --- a/usr.bin/window/wwchild.c +++ b/usr.bin/window/wwchild.c @@ -48,10 +48,9 @@ static char rcsid[] = void wwchild() { - int olderrno; register struct ww **wp; - union wait w; - int pid; + pid_t pid; + int olderrno, w; char collected = 0; olderrno = errno; -- cgit v1.1