int main()

in flood.c [136:196]


int main(int argc, char** argv)
{
    apr_status_t stat;
    config_t *config;

    /* FIXME: Where is Roy's change to return the global pool... */
    apr_initialize();
    atexit(apr_terminate);

    apr_pool_create(&local_pool, NULL);

#if FLOOD_HAS_OPENSSL
    /* FIXME: HHAAAAAAAAAAAAAAACCCCCCCCCCCKKKKKKKKKKK! */
    /* Should be a run-time option with SSL, but Justin hates singleton. */
    ssl_init_socket(local_pool);
#endif /* FLOOD_HAS_OPENSSL */
   
    apr_file_open_stdout(&local_stdout, local_pool);
    apr_file_open_stderr(&local_stderr, local_pool);

    if (argc == 1) {
        apr_file_open_stdin(&local_stdin, local_pool);
    }
    else if ((stat = apr_file_open(&local_stdin, argv[1], APR_READ,
                         APR_OS_DEFAULT, local_pool)) != APR_SUCCESS)
    {
        char buf[256];
        apr_strerror(stat, (char*) &buf, sizeof(buf));
        apr_file_printf(local_stderr,
                        "Error opening configuration file: %s.\n",
                        (char*)&buf);
        exit(-1);
    }

    /* parse the config */
    config = parse_config(local_stdin, local_pool);

    if ((stat = set_seed(config)) != APR_SUCCESS) {
        char buf[256];
        apr_strerror(stat, (char*) &buf, 256);
        apr_file_printf(local_stderr, "Error running test profile: %s.\n", 
                        (char*)&buf);
        exit(-1);
    }

    if ((stat = check_versions(config)) != APR_SUCCESS) {
        exit(-1);
    }

    if ((stat = run_farm(config, "Bingo", local_pool)) != APR_SUCCESS) {
        char buf[256];
        apr_strerror(stat, (char*) &buf, 256);
        apr_file_printf(local_stderr, "Error running test profile: %s.\n", 
                        (char*)&buf);
        exit(-1);
    }

    /* report results -- for now just print results to stdout */
 
    return EXIT_SUCCESS;
}