require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_STDIO_H_)) {
    eval 'sub _STDIO_H_ () {1;}' unless defined(&_STDIO_H_);
    require 'sys/cdefs.ph';
    require 'sys/featuretest.ph';
    require 'sys/ansi.ph';
    if((!defined(&_ANSI_SOURCE)  && !defined(&_POSIX_C_SOURCE)  && !defined(&_XOPEN_SOURCE)) || (((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200809 || defined(&_ISOC99_SOURCE) || ((defined(&__STDC_VERSION__) ? &__STDC_VERSION__ : undef) - 0) >= 199901 || ((defined(&__cplusplus) ? &__cplusplus : undef) - 0) >= 201103 || defined(&_NETBSD_SOURCE))) {
	eval 'sub __STDIO_C99_FEATURES () {1;}' unless defined(&__STDIO_C99_FEATURES);
    }
    if(defined(&_BSD_SIZE_T_)) {
	undef(&_BSD_SIZE_T_) if defined(&_BSD_SIZE_T_);
    }
    if(defined(&_BSD_SSIZE_T_)) {
	undef(&_BSD_SSIZE_T_) if defined(&_BSD_SSIZE_T_);
    }
    if(defined(&_POSIX_C_SOURCE)) {
	unless(defined(&__VA_LIST_DECLARED)) {
	    eval 'sub __VA_LIST_DECLARED () {1;}' unless defined(&__VA_LIST_DECLARED);
	}
    }
    require 'sys/null.ph';
    eval 'sub _FSTDIO () {1;}' unless defined(&_FSTDIO);
    eval 'sub __SLBF () {0x1;}' unless defined(&__SLBF);
    eval 'sub __SNBF () {0x2;}' unless defined(&__SNBF);
    eval 'sub __SRD () {0x4;}' unless defined(&__SRD);
    eval 'sub __SWR () {0x8;}' unless defined(&__SWR);
    eval 'sub __SRW () {0x10;}' unless defined(&__SRW);
    eval 'sub __SEOF () {0x20;}' unless defined(&__SEOF);
    eval 'sub __SERR () {0x40;}' unless defined(&__SERR);
    eval 'sub __SMBF () {0x80;}' unless defined(&__SMBF);
    eval 'sub __SAPP () {0x100;}' unless defined(&__SAPP);
    eval 'sub __SSTR () {0x200;}' unless defined(&__SSTR);
    eval 'sub __SOPT () {0x400;}' unless defined(&__SOPT);
    eval 'sub __SNPT () {0x800;}' unless defined(&__SNPT);
    eval 'sub __SOFF () {0x1000;}' unless defined(&__SOFF);
    eval 'sub __SMOD () {0x2000;}' unless defined(&__SMOD);
    eval 'sub __SALC () {0x4000;}' unless defined(&__SALC);
    eval 'sub _IOFBF () {0;}' unless defined(&_IOFBF);
    eval 'sub _IOLBF () {1;}' unless defined(&_IOLBF);
    eval 'sub _IONBF () {2;}' unless defined(&_IONBF);
    eval 'sub BUFSIZ () {1024;}' unless defined(&BUFSIZ);
    eval 'sub EOF () {(-1);}' unless defined(&EOF);
    eval 'sub FOPEN_MAX () {20;}' unless defined(&FOPEN_MAX);
    eval 'sub FILENAME_MAX () {1024;}' unless defined(&FILENAME_MAX);
    if(defined(&_XOPEN_SOURCE) || defined(&_NETBSD_SOURCE)) {
	eval 'sub P_tmpdir () {"/tmp/";}' unless defined(&P_tmpdir);
    }
    eval 'sub L_tmpnam () {1024;}' unless defined(&L_tmpnam);
    unless(defined(&TMP_MAX)) {
	eval 'sub TMP_MAX () {308915776;}' unless defined(&TMP_MAX);
    }
    unless(defined(&SEEK_SET)) {
	eval 'sub SEEK_SET () {0;}' unless defined(&SEEK_SET);
    }
    unless(defined(&SEEK_CUR)) {
	eval 'sub SEEK_CUR () {1;}' unless defined(&SEEK_CUR);
    }
    unless(defined(&SEEK_END)) {
	eval 'sub SEEK_END () {2;}' unless defined(&SEEK_END);
    }
    eval 'sub stdin () {(& $__sF[0]);}' unless defined(&stdin);
    eval 'sub stdout () {(& $__sF[1]);}' unless defined(&stdout);
    eval 'sub stderr () {(& $__sF[2]);}' unless defined(&stderr);
    unless(defined(&__AUDIT__)) {
    }
    if(defined(&_POSIX_C_SOURCE) || defined(&_XOPEN_SOURCE)) {
    } else {
    }
    unless(defined(&__LIBC12_SOURCE__)) {
    }
    if(defined(&_POSIX_C_SOURCE) || defined(&_XOPEN_SOURCE) || defined(&_NETBSD_SOURCE)) {
	eval 'sub L_ctermid () {1024;}' unless defined(&L_ctermid);
	eval 'sub L_cuserid () {9;}' unless defined(&L_cuserid);
	unless(defined(&__CUSERID_DECLARED)) {
	    eval 'sub __CUSERID_DECLARED () {1;}' unless defined(&__CUSERID_DECLARED);
	}
    }
    if(defined(&__STDIO_C99_FEATURES) || ((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 199506 || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0) >= 500|| defined(&_REENTRANT)) {
    }
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 2|| ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0) >= 2|| defined(&_NETBSD_SOURCE)) {
    }
    if(defined(&_NETBSD_SOURCE)) {
    }
    if(defined(&__STDIO_C99_FEATURES) || ((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200112 || (defined(&_XOPEN_SOURCE)  && defined(&_XOPEN_SOURCE_EXTENDED)) || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0) >= 500) {
    }
    if(defined(&_XOPEN_SOURCE) || defined(&_NETBSD_SOURCE)) {
	unless(defined(&__AUDIT__)) {
	}
    }
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200112 || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0) >= 500|| defined(&_NETBSD_SOURCE)) {
	unless(defined(&off_t)) {
	    eval 'sub off_t () { &__off_t;}' unless defined(&off_t);
	}
    }
    if(defined(&__STDIO_C99_FEATURES)) {
    }
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub FPARSELN_UNESCESC () {0x1;}' unless defined(&FPARSELN_UNESCESC);
	eval 'sub FPARSELN_UNESCCONT () {0x2;}' unless defined(&FPARSELN_UNESCCONT);
	eval 'sub FPARSELN_UNESCCOMM () {0x4;}' unless defined(&FPARSELN_UNESCCOMM);
	eval 'sub FPARSELN_UNESCREST () {0x8;}' unless defined(&FPARSELN_UNESCREST);
	eval 'sub FPARSELN_UNESCALL () {0xf;}' unless defined(&FPARSELN_UNESCALL);
	eval 'sub fropen {
	    my($cookie, $fn) = @_;
    	    eval q( &funopen($cookie, $fn, 0, 0, 0));
	}' unless defined(&fropen);
	eval 'sub fwopen {
	    my($cookie, $fn) = @_;
    	    eval q( &funopen($cookie, 0, $fn, 0, 0));
	}' unless defined(&fwopen);
	eval 'sub fropen2 {
	    my($cookie, $fn) = @_;
    	    eval q( &funopen2($cookie, $fn, 0, 0, 0, 0));
	}' unless defined(&fropen2);
	eval 'sub fwopen2 {
	    my($cookie, $fn) = @_;
    	    eval q( &funopen2($cookie, 0, $fn, 0, 0, 0));
	}' unless defined(&fwopen2);
    }
    eval 'sub __sgetc {
        my($p) = @_;
	    eval q((---> &_r < 0?  &__srget : (*($p)-> &_p++)));
    }' unless defined(&__sgetc);
    if(defined(&__GNUC__)  && defined(&__STDC__)) {
	eval 'sub __sputc {
	    my($_c,$_p) = @_;
    	    eval q({  &if (-- ($_p->{_w}) >= 0|| ( ($_p->{_w}) >=  ($_p->{_lbfsize})  && $_c != ord(\'\\\\n\'))) * ($_p->{_p})++ = $_c;  &else  &__swbuf($_c, $_p); });
	}' unless defined(&__sputc);
    } else {
	eval 'sub __sputc {
	    my($c, $p) = @_;
    	    eval q((---> &_w < 0? -> &_w >= -> &_lbfsize ? (*-> &_p = ), *-> &_p != ord(\'\\\\n\' ? 				*->_p++ : 				__swbuf(\'\\\\n\'), $p) :  &__swbuf(($c), $p) : (*($p)-> &_p = ($c), *($p)-> &_p++)));
	}' unless defined(&__sputc);
    }
    eval 'sub __sfeof {
        my($p) = @_;
	    eval q(((($p)-> &_flags &  &__SEOF) != 0));
    }' unless defined(&__sfeof);
    eval 'sub __sferror {
        my($p) = @_;
	    eval q(((($p)-> &_flags &  &__SERR) != 0));
    }' unless defined(&__sferror);
    eval 'sub __sclearerr {
        my($p) = @_;
	    eval q((( &void)(($p)-> &_flags &= ~( &__SERR| &__SEOF))));
    }' unless defined(&__sclearerr);
    eval 'sub __sfileno {
        my($p) = @_;
	    eval q((-> &_file == -1? -1: ($p)-> &_file));
    }' unless defined(&__sfileno);
    if(!defined(&__lint__)  && !defined(&__cplusplus)) {
	if(!defined(&_REENTRANT)  && !defined(&_PTHREADS)) {
	    eval 'sub feof {
	        my($p) = @_;
    		eval q( &__sfeof($p));
	    }' unless defined(&feof);
	    eval 'sub ferror {
	        my($p) = @_;
    		eval q( &__sferror($p));
	    }' unless defined(&ferror);
	    eval 'sub clearerr {
	        my($p) = @_;
    		eval q( &__sclearerr($p));
	    }' unless defined(&clearerr);
	    eval 'sub getc {
	        my($fp) = @_;
    		eval q( &__sgetc($fp));
	    }' unless defined(&getc);
	    eval 'sub putc {
	        my($x, $fp) = @_;
    		eval q( &__sputc($x, $fp));
	    }' unless defined(&putc);
	}
	eval 'sub getchar () {
	    eval q( &getc( &stdin));
	}' unless defined(&getchar);
	eval 'sub putchar {
	    my($x) = @_;
    	    eval q( &putc($x,  &stdout));
	}' unless defined(&putchar);
    }
    if((defined(&_POSIX_C_SOURCE) || defined(&_XOPEN_SOURCE) || defined(&_NETBSD_SOURCE))  && !defined(&__cplusplus)) {
	if(!defined(&_REENTRANT)  && !defined(&_PTHREADS)) {
	    eval 'sub fileno {
	        my($p) = @_;
    		eval q( &__sfileno($p));
	    }' unless defined(&fileno);
	}
    }
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200809 || defined(&_NETBSD_SOURCE)) {
    }
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 199506 || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0) >= 500|| defined(&_REENTRANT) || defined(&_NETBSD_SOURCE)  && !defined(&__cplusplus)) {
	eval 'sub getc_unlocked {
	    my($fp) = @_;
    	    eval q( &__sgetc($fp));
	}' unless defined(&getc_unlocked);
	eval 'sub putc_unlocked {
	    my($x, $fp) = @_;
    	    eval q( &__sputc($x, $fp));
	}' unless defined(&putc_unlocked);
	eval 'sub getchar_unlocked () {
	    eval q( &getc_unlocked( &stdin));
	}' unless defined(&getchar_unlocked);
	eval 'sub putchar_unlocked {
	    my($x) = @_;
    	    eval q( &putc_unlocked($x,  &stdout));
	}' unless defined(&putchar_unlocked);
    }
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200809 || ((defined(&_XOPEN_SOURCE) ? &_XOPEN_SOURCE : undef) - 0) >= 700|| defined(&_NETBSD_SOURCE)) {
    }
    if(((defined(&_POSIX_C_SOURCE) ? &_POSIX_C_SOURCE : undef) - 0) >= 200809 || defined(&_NETBSD_SOURCE)) {
	unless(defined(&__LOCALE_T_DECLARED)) {
	    eval 'sub __LOCALE_T_DECLARED () {1;}' unless defined(&__LOCALE_T_DECLARED);
	}
	unless(defined(&__AUDIT__)) {
	}
	if(defined(&_NETBSD_SOURCE)) {
	}
    }
    if((defined(&_FORTIFY_SOURCE) ? &_FORTIFY_SOURCE : undef) > 0) {
	require 'ssp/stdio.ph';
    }
}
1;
