> #define WNOHANG 0x1 > #define WUNTRACED 0x2 > #define _WSTOPPED 0177 > #ifdef _BSD > #define _W_INT(w) (*(int *)&(w)) /* convert union wait to int */ > #else > #define _W_INT(i) (i) > #endif > #define _WSTATUS(x) (_W_INT(x) & _WSTOPPED) > #if ( !defined(_OSF_SOURCE) && !defined(_XOPEN_SOURCE_EXTENDED) ) > #define WIFSTOPPED(x) (_WSTATUS(x) == _WSTOPPED) > #else > #endif /* !_OSF_SOURCE && !_XOPEN_SOURCE_EXTENDED */ > #define WSTOPSIG(x) (WIFSTOPPED(x) ? ((_W_INT(x) >> 8) & 0177) : -1) > #define WIFEXITED(x) (_WSTATUS(x) == 0) > #define WEXITSTATUS(x) (WIFEXITED(x) ? ((_W_INT(x) >> 8) & 0377) : -1) > #define WIFSIGNALED(x) (_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0) > #define WTERMSIG(x) (WIFSIGNALED(x) ? _WSTATUS(x) : -1) > > Judging by the cpp output, the (i) definition of _W_INT(x) is taken.
And here is the expansion of WTERMSIG(x): ( ( ( ( x ) & 0177 ) != 0177 && ( ( x ) & 0177 ) != 0 ) ? ( ( x ) & 0177 ) : - 1 ) and of WEXITSTATUS(x): ( ( ( ( x ) & 0177 ) == 0 ) ? ( ( ( x ) >> 8 ) & 0377 ) : - 1 )