require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_SYS_WAIT_H_)) {
    eval 'sub _SYS_WAIT_H_ () {1;}' unless defined(&_SYS_WAIT_H_);
    require 'sys/cdefs.ph';
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
	eval 'sub _W_INT {
	    my($w) = @_;
    	    eval q((*($w)));
	}' unless defined(&_W_INT);
    } else {
	eval 'sub _W_INT {
	    my($i) = @_;
    	    eval q(($i));
	}' unless defined(&_W_INT);
    }
    eval 'sub _WSTATUS {
        my($x) = @_;
	    eval q(( &_W_INT($x) & 0177));
    }' unless defined(&_WSTATUS);
    eval 'sub _WSTOPPED () {0177;}' unless defined(&_WSTOPPED);
    eval 'sub _WCONTINUED () {0177777;}' unless defined(&_WCONTINUED);
    eval 'sub WIFSTOPPED {
        my($x) = @_;
	    eval q((( &_W_INT($x) & 0xff) ==  &_WSTOPPED));
    }' unless defined(&WIFSTOPPED);
    eval 'sub WSTOPSIG {
        my($x) = @_;
	    eval q((( &_W_INT($x) >> 8) & 0xff));
    }' unless defined(&WSTOPSIG);
    eval 'sub WIFSIGNALED {
        my($x) = @_;
	    eval q(( &_WSTATUS($x) !=  &_WSTOPPED  &&  &_WSTATUS($x) != 0));
    }' unless defined(&WIFSIGNALED);
    eval 'sub WTERMSIG {
        my($x) = @_;
	    eval q(( &_WSTATUS($x)));
    }' unless defined(&WTERMSIG);
    eval 'sub WIFEXITED {
        my($x) = @_;
	    eval q(( &_WSTATUS($x) == 0));
    }' unless defined(&WIFEXITED);
    eval 'sub WEXITSTATUS {
        my($x) = @_;
	    eval q((( &_W_INT($x) >> 8) & 0xff));
    }' unless defined(&WEXITSTATUS);
    eval 'sub WIFCONTINUED {
        my($x) = @_;
	    eval q((( &_W_INT($x) &  &_WCONTINUED) ==  &_WCONTINUED));
    }' unless defined(&WIFCONTINUED);
    if((defined(&__XPG_VISIBLE) ? &__XPG_VISIBLE : 0)) {
	eval 'sub WCOREFLAG () {0200;}' unless defined(&WCOREFLAG);
	eval 'sub WCOREDUMP {
	    my($x) = @_;
    	    eval q(( &_W_INT($x) &  &WCOREFLAG));
	}' unless defined(&WCOREDUMP);
	eval 'sub W_EXITCODE {
	    my($ret, $sig) = @_;
    	    eval q((($ret) << 8| ($sig)));
	}' unless defined(&W_EXITCODE);
	eval 'sub W_STOPCODE {
	    my($sig) = @_;
    	    eval q((($sig) << 8|  &_WSTOPPED));
	}' unless defined(&W_STOPCODE);
    }
    eval 'sub WNOHANG () {1;}' unless defined(&WNOHANG);
    eval 'sub WUNTRACED () {2;}' unless defined(&WUNTRACED);
    if((defined(&__XPG_VISIBLE) ? &__XPG_VISIBLE : 0)) {
	eval 'sub WALTSIG () {4;}' unless defined(&WALTSIG);
    }
    eval 'sub WCONTINUED () {8;}' unless defined(&WCONTINUED);
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
	eval 'sub WAIT_ANY () {(-1);}' unless defined(&WAIT_ANY);
	eval 'sub WAIT_MYPGRP () {0;}' unless defined(&WAIT_MYPGRP);
	require 'sys/types.ph';
	if((defined(&_BYTE_ORDER) ? &_BYTE_ORDER : 0) == (defined(&_LITTLE_ENDIAN) ? &_LITTLE_ENDIAN : 0)) {
	}
	if((defined(&_BYTE_ORDER) ? &_BYTE_ORDER : 0) == (defined(&_BIG_ENDIAN) ? &_BIG_ENDIAN : 0)) {
	}
	if((defined(&_BYTE_ORDER) ? &_BYTE_ORDER : 0) == (defined(&_LITTLE_ENDIAN) ? &_LITTLE_ENDIAN : 0)) {
	}
	if((defined(&_BYTE_ORDER) ? &_BYTE_ORDER : 0) == (defined(&_BIG_ENDIAN) ? &_BIG_ENDIAN : 0)) {
	}
	eval 'sub w_termsig () { ($w_T->{w_Termsig});}' unless defined(&w_termsig);
	eval 'sub w_coredump () { ($w_T->{w_Coredump});}' unless defined(&w_coredump);
	eval 'sub w_retcode () { ($w_T->{w_Retcode});}' unless defined(&w_retcode);
	eval 'sub w_stopval () { ($w_S->{w_Stopval});}' unless defined(&w_stopval);
	eval 'sub w_stopsig () { ($w_S->{w_Stopsig});}' unless defined(&w_stopsig);
	eval 'sub WSTOPPED () { &_WSTOPPED;}' unless defined(&WSTOPPED);
    }
    unless(defined(&_KERNEL)) {
	require 'sys/types.ph';
	if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
	}
    }
}
1;
