require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&BOZOHTTPD_H_)) {
    eval 'sub BOZOHTTPD_H_ () {1;}' unless defined(&BOZOHTTPD_H_);
    require './netbsd_queue.ph';
    require 'stdbool.ph';
    require 'stdio.ph';
    require 'signal.ph';
    require 'sys/stat.ph';
    unless(defined(&NO_LUA_SUPPORT)) {
	require 'lua.ph';
    }
    unless(defined(&NO_BLOCKLIST_SUPPORT)) {
	require 'blocklist.ph';
    }
    if(defined(&HAVE_NBUTIL_H)) {
	require 'nbutil.ph';
    }
    unless(defined(&NO_LUA_SUPPORT)) {
    }
    unless(defined(&NO_LUA_SUPPORT)) {
    }
    eval 'sub HTTP_GET () {0x1;}' unless defined(&HTTP_GET);
    eval 'sub HTTP_POST () {0x2;}' unless defined(&HTTP_POST);
    eval 'sub HTTP_HEAD () {0x3;}' unless defined(&HTTP_HEAD);
    eval 'sub HTTP_OPTIONS () {0x4;}' unless defined(&HTTP_OPTIONS);
    eval 'sub HTTP_PUT () {0x5;}' unless defined(&HTTP_PUT);
    eval 'sub HTTP_DELETE () {0x6;}' unless defined(&HTTP_DELETE);
    eval 'sub HTTP_TRACE () {0x7;}' unless defined(&HTTP_TRACE);
    eval 'sub HTTP_CONNECT () {0x8;}' unless defined(&HTTP_CONNECT);
    unless(defined(&NO_USER_SUPPORT)) {
    }
    if(defined(&DO_HTPASSWD)) {
    }
    eval 'sub BOZOHOST {
        my($HTTPD,$REQUEST) = @_;
	    eval q((($REQUEST)-> &hr_virthostname ? ($REQUEST)-> &hr_virthostname : ($HTTPD)-> &virthostname));
    }' unless defined(&BOZOHOST);
    if(defined(&__mc68010__)) {
	unless(defined(&BOZO_WRSZ)) {
	    eval 'sub BOZO_WRSZ () {(16* 1024);}' unless defined(&BOZO_WRSZ);
	}
	unless(defined(&BOZO_MMAPSZ)) {
	    eval 'sub BOZO_MMAPSZ () {( &BOZO_WRSZ * 4);}' unless defined(&BOZO_MMAPSZ);
	}
    }
    unless(defined(&BOZO_WRSZ)) {
	eval 'sub BOZO_WRSZ () {(64* 1024);}' unless defined(&BOZO_WRSZ);
    }
    unless(defined(&BOZO_MMAPSZ)) {
	eval 'sub BOZO_MMAPSZ () {( &BOZO_WRSZ * 1024);}' unless defined(&BOZO_MMAPSZ);
    }
    eval 'sub BOZO_HEADERS_MAX_SIZE () {(16* 1024);}' unless defined(&BOZO_HEADERS_MAX_SIZE);
    eval 'sub BOZO_MINBUFSIZE () {(4* 1024);}' unless defined(&BOZO_MINBUFSIZE);
    eval 'sub DEBUG_NORMAL () {1;}' unless defined(&DEBUG_NORMAL);
    eval 'sub DEBUG_FAT () {2;}' unless defined(&DEBUG_FAT);
    eval 'sub DEBUG_OBESE () {3;}' unless defined(&DEBUG_OBESE);
    eval 'sub DEBUG_EXPLODING () {4;}' unless defined(&DEBUG_EXPLODING);
    eval 'sub strornull {
        my($x) = @_;
	    eval q((($x) ? ($x) : \\"<null>\\"));
    }' unless defined(&strornull);
    if((defined(&__GNUC__)  && (defined(&__GNUC__) ? &__GNUC__ : undef) >= 3) || defined(&__lint__)) {
	eval 'sub BOZO_PRINTFLIKE {
	    my($x,$y) = @_;
    	    eval q( &__attribute__(( &__format__( &__printf__, $x,$y))));
	}' unless defined(&BOZO_PRINTFLIKE);
	eval 'sub BOZO_DEAD () { &__attribute__(( &__noreturn__));}' unless defined(&BOZO_DEAD);
	eval 'sub BOZO_CHECKRET () { &__attribute__(( &__warn_unused_result__));}' unless defined(&BOZO_CHECKRET);
    } else {
	eval 'sub BOZO_PRINTFLIKE {
	    my($x,$y) = @_;
    	    eval q();
	}' unless defined(&BOZO_PRINTFLIKE);
	eval 'sub BOZO_DEAD () {1;}' unless defined(&BOZO_DEAD);
	eval 'sub BOZO_CHECKRET () {1;}' unless defined(&BOZO_CHECKRET);
    }
    if(defined(&NO_DEBUG)) {
	eval 'sub debug {
	    my($x) = @_;
    	    eval q();
	}' unless defined(&debug);
	eval 'sub have_debug () {(0);}' unless defined(&have_debug);
    } else {
	eval 'sub debug {
	    my($x) = @_;
    	    eval q( &debug__ $x);
	}' unless defined(&debug);
	eval 'sub have_debug () {(1);}' unless defined(&have_debug);
    }
    eval 'sub BOZO_HTTP_PORT () {"80";}' unless defined(&BOZO_HTTP_PORT);
    eval 'sub BOZO_HTTPS_PORT () {"443";}' unless defined(&BOZO_HTTPS_PORT);
    unless(defined(&REDIRECT_FILE)) {
	eval 'sub REDIRECT_FILE () {".bzredirect";}' unless defined(&REDIRECT_FILE);
    }
    unless(defined(&ABSREDIRECT_FILE)) {
	eval 'sub ABSREDIRECT_FILE () {".bzabsredirect";}' unless defined(&ABSREDIRECT_FILE);
    }
    unless(defined(&REMAP_FILE)) {
	eval 'sub REMAP_FILE () {".bzremap";}' unless defined(&REMAP_FILE);
    }
    unless(defined(&AUTH_FILE)) {
	eval 'sub AUTH_FILE () {".htpasswd";}' unless defined(&AUTH_FILE);
    }
    eval 'sub bozo_noop () { &do { }  &while ( 0);}' unless defined(&bozo_noop);
    eval 'sub have_core () {(1);}' unless defined(&have_core);
    if(defined(&NO_SSL_SUPPORT)) {
	eval 'sub bozo_ssl_set_opts {
	    my($w, $x, $y) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_ssl_set_opts);
	eval 'sub bozo_ssl_set_ciphers {
	    my($w, $x) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_ssl_set_ciphers);
	eval 'sub bozo_ssl_init {
	    my($x) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_ssl_init);
	eval 'sub bozo_ssl_accept {
	    my($x) = @_;
    	    eval q((0));
	}' unless defined(&bozo_ssl_accept);
	eval 'sub bozo_ssl_shutdown {
	    my($x) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_ssl_shutdown);
	eval 'sub bozo_ssl_destroy {
	    my($x) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_ssl_destroy);
	eval 'sub have_ssl () {(0);}' unless defined(&have_ssl);
    } else {
	eval 'sub have_ssl () {(1);}' unless defined(&have_ssl);
    }
    if(defined(&DO_HTPASSWD)) {
    } else {
	eval 'sub bozo_auth_init {
	    my($x) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_auth_init);
	eval 'sub bozo_auth_check {
	    my($x, $y) = @_;
    	    eval q((0));
	}' unless defined(&bozo_auth_check);
	eval 'sub bozo_auth_cleanup {
	    my($x) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_auth_cleanup);
	eval 'sub bozo_auth_check_headers {
	    my($y, $z, $a, $b) = @_;
    	    eval q((0));
	}' unless defined(&bozo_auth_check_headers);
	eval 'sub bozo_auth_check_401 {
	    my($x, $y) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_auth_check_401);
	eval 'sub bozo_auth_cgi_setenv {
	    my($x, $y) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_auth_cgi_setenv);
	eval 'sub bozo_auth_cgi_count {
	    my($x) = @_;
    	    eval q((0));
	}' unless defined(&bozo_auth_cgi_count);
    }
    if(defined(&NO_CGIBIN_SUPPORT)) {
	eval 'sub bozo_cgi_setbin {
	    my($h,$s) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_cgi_setbin);
	eval 'sub bozo_process_cgi {
	    my($h) = @_;
    	    eval q((0));
	}' unless defined(&bozo_process_cgi);
	eval 'sub have_cgibin () {(0);}' unless defined(&have_cgibin);
    } else {
	eval 'sub have_cgibin () {(1);}' unless defined(&have_cgibin);
    }
    if(defined(&NO_LUA_SUPPORT)) {
	eval 'sub bozo_process_lua {
	    my($h) = @_;
    	    eval q((0));
	}' unless defined(&bozo_process_lua);
	eval 'sub bozo_add_lua_map {
	    my($h,$s,$t) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_add_lua_map);
	eval 'sub have_lua () {(0);}' unless defined(&have_lua);
    } else {
	eval 'sub have_lua () {(1);}' unless defined(&have_lua);
    }
    if(defined(&NO_DAEMON_MODE)) {
	eval 'sub bozo_daemon_init {
	    my($x) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_daemon_init);
	eval 'sub bozo_daemon_fork {
	    my($x) = @_;
    	    eval q((0));
	}' unless defined(&bozo_daemon_fork);
	eval 'sub bozo_daemon_closefds {
	    my($x) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_daemon_closefds);
	eval 'sub have_daemon_mode () {(0);}' unless defined(&have_daemon_mode);
    } else {
	eval 'sub have_daemon_mode () {(1);}' unless defined(&have_daemon_mode);
    }
    if(defined(&NO_USER_SUPPORT)) {
	eval 'sub bozo_user_transform {
	    my($x) = @_;
    	    eval q((0));
	}' unless defined(&bozo_user_transform);
	eval 'sub bozo_user_free {
	    my($x) = @_;
    	    eval q();
	}' unless defined(&bozo_user_free);
	eval 'sub have_user () {(0);}' unless defined(&have_user);
    } else {
	eval 'sub bozo_user_free {
	    my($x) = @_;
    	    eval q( &free($x));
	}' unless defined(&bozo_user_free);
	eval 'sub have_user () {(1);}' unless defined(&have_user);
    }
    if(defined(&NO_DIRINDEX_SUPPORT)) {
	eval 'sub bozo_dir_index {
	    my($a, $b, $c) = @_;
    	    eval q((0));
	}' unless defined(&bozo_dir_index);
	eval 'sub have_dirindex () {(0);}' unless defined(&have_dirindex);
    } else {
	eval 'sub have_dirindex () {(1);}' unless defined(&have_dirindex);
    }
    if(defined(&NO_DYNAMIC_CONTENT)) {
	eval 'sub bozo_add_content_map_mime {
	    my($h,$s,$t,$u,$v) = @_;
    	    eval q( &bozo_noop);
	}' unless defined(&bozo_add_content_map_mime);
	eval 'sub have_dynamic_content () {(0);}' unless defined(&have_dynamic_content);
    } else {
	eval 'sub have_dynamic_content () {(1);}' unless defined(&have_dynamic_content);
    }
    if((defined(&have_cgibin) ? &have_cgibin : undef)  && (defined(&have_dynamic_content) ? &have_dynamic_content : undef)) {
    } else {
	eval 'sub bozo_add_content_map_cgi {
	    my($h,$s,$t) = @_;
    	    eval q();
	}' unless defined(&bozo_add_content_map_cgi);
    }
}
1;
