'\"macro stdmacro
.if n .pH g5.wstat @(#)wstat	40.10 of 10/10/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} wstat 5 "" "\&"
.if \nX=1 .ds x} wstat 5 ""
.if \nX=2 .ds x} wstat 5 "" "\&"
.if \nX=3 .ds x} wstat "" "" "\&"
.TH \*(x}
.SH NAME
\f4wstat\f1 \- wait status
.SH SYNOPSIS
\f4#include <sys/wait.h>\f1
.SH DESCRIPTION
When a process waits for status from its children via either the
\f4wait\fP
or
\f4waitpid\fP
function, the status returned may be evaluated with the following
macros, defined in
\f4sys/wait.h\f1. These macros evaluate to integral expressions.
The \f2stat\fP argument to these macros is the integer value returned from
\f4wait\fP
or
\f4waitpid\fP.
.PP
.RS 2
.TP 20
\f4WIFEXITED(\f2stat\f4)\f1
Evaluates to a non-zero value if status was returned for a child
process that terminated normally.
.TP
\f4WEXITSTATUS(\f2stat\f4)\f1
If the value of 
\f4WIFEXITED(\f2stat\f4)\f1
is non-zero, this macro evaluates to the exit code that the child
process passed to 
\f4_exit\fP
or
\f4exit\fP,
or the value that the child process returned from
\f4main\f1.
.TP
\f4WIFSIGNALED(\f2stat\f4)\f1
Evaluates to a non-zero value if status was returned for a child process
that terminated due to the receipt of a signal.
.TP
\f4WTERMSIG(\f2stat\f4)\f1
If the value of 
\f4WIFSIGNALED(\f2stat\f4)\f1
is non-zero, this macro evaluates to the number of the signal that caused the
termination of the child process.
.TP
\f4WIFSTOPPED(\f2stat\f4)\f1
Evaluates to a non-zero value if status was returned for a child process
that is currently stopped.
.TP
\f4WSTOPSIG(\f2stat\f4)\f1
If the value of
\f4WIFSTOPPED(\f2stat\f4)\f1
is non-zero, this macro evaluates to the number of the signal that caused the
child process to stop.
.TP
\f4WIFCONTINUED\fP(\f2stat\f1)
Evaluates to a non-zero value if status was returned for a child
process that has continued.
.TP
\f4WCOREDUMP\fP(\f2stat\f1)
If the value of \f4WIFSIGNALED\fP (\f2stat\f1) is non-zero, this
macro evaluates to a non-zero value if a core image of the terminated
child was created.
.RE
.SH SEE ALSO
\f4exit\fP(2), \f4wait\fP(2), \f4waitpid\fP(3C).
