.th wait IV 4/21/86
.sh NAME
wait - wait for process to terminate
.sh SYNOPSIS
wait(status)
.br
int *status;
.ft R
.sh DESCRIPTION
Wait causes its caller to delay until one of its child processes
terminates.  If any child has died since the last wait, return is
immediate; if there are no children, return is immediate with the error
value of -1 returned.  The normal return yields the process ID of the
terminated child.  In the case of several children several wait calls
are needed to learn of all the deaths.
.s3
If no error is indicated on return, the high byte stored into status
contains the low byte of the child process the argument of exit when it
terminated.  The status low byte contains the termination status of the
process.  
.sh "SEE ALSO"
exit (IV), fork (IV)
.sh DIAGNOSTICS
The error bit (c-bit) is set if there are no children which have not
previously been waited for.  From C, a returned value of -1 indicates
an error.

