int main (int argc, char **argv) { ret_t ret; struct sigaction act; ret = check_for_python(); if (ret != ret_ok) { PRINT_MSG ("ERROR: Couldn't find python.\n"); exit (EXIT_ERROR); } /* Signal handling */ act.sa_handler = SIG_IGN; sigaction (SIGPIPE, &act, NULL); memset(&act, 0, sizeof(act)); act.sa_sigaction = signals_handler; act.sa_flags = SA_SIGINFO; sigaction (SIGCHLD, &act, NULL); sigaction (SIGINT, &act, NULL); sigaction (SIGTERM, &act, NULL); /* Initialize the embedded server */ cherokee_init(); cherokee_spawner_set_active (false); process_parameters (argc, argv); ret = cherokee_server_new (&srv); if (ret != ret_ok) exit (EXIT_ERROR); ret = config_server (srv); if (ret != ret_ok) exit (EXIT_ERROR); ret = cherokee_server_initialize (srv); if (ret != ret_ok) exit (EXIT_ERROR); print_connection_info(); ret = cherokee_server_unlock_threads (srv); if (ret != ret_ok) exit (EXIT_ERROR); do { ret = cherokee_server_step (srv); } while (ret == ret_eagain); cherokee_server_stop (srv); cherokee_server_free (srv); cherokee_mrproper(); return EXIT_OK; }
int main (int argc, char **argv) { ret_t ret; config_file = strdup (DEFAULT_CONFIG_FILE); if (config_file == NULL) { PRINT_MSG ("ERROR: Couldn't allocate memory.\n"); exit (EXIT_ERROR); } cherokee_init(); ret = cherokee_server_new (&srv); if (ret < ret_ok) { exit (EXIT_ERROR_FATAL); } ret = process_parameters (argc, argv); if (ret != ret_ok) { exit (EXIT_ERROR_FATAL); } if (print_modules) { cherokee_info_build_print (srv); exit (EXIT_OK_ONCE); } if (just_test) { ret = test_configuration_file(); if (ret != ret_ok) { exit (EXIT_ERROR); } exit (EXIT_OK_ONCE); } ret = common_server_initialization (srv); if (ret < ret_ok) { exit (EXIT_ERROR_FATAL); } do { ret = cherokee_server_step (srv); } while (ret == ret_eagain); cherokee_server_stop (srv); cherokee_server_free (srv); free (config_file); cherokee_mrproper(); return EXIT_OK; }
int main (int argc, char **argv) { ret_t ret; cherokee_init(); ret = cherokee_server_new (&srv); if (ret < ret_ok) return 1; ret = process_parameters (argc, argv); if (ret != ret_ok) exit (EXIT_OK_ONCE); if (print_modules) { cherokee_info_build_print (srv); exit (EXIT_OK_ONCE); } if (just_test) { ret = test_configuration_file(); if (ret != ret_ok) exit(EXIT_ERROR); exit (EXIT_OK_ONCE); } ret = common_server_initialization (srv); if (ret < ret_ok) return 2; do { ret = cherokee_server_step (srv); } while (ret == ret_eagain); cherokee_server_stop (srv); cherokee_server_free (srv); if (config_file) free (config_file); cherokee_mrproper(); return EXIT_OK; }
int main (int argc, char **argv) { ret_t ret; struct sigaction act; /* Globals */ document_root = strdup (DEFAULT_DOCUMENTROOT); config_file = strdup (DEFAULT_CONFIG_FILE); bind_to = strdup (DEFAULT_BIND); if ((!bind_to) || (!config_file) || (!document_root)) { PRINT_MSG ("ERROR: Couldn't allocate memory.\n"); exit (EXIT_ERROR); } /* Python */ ret = check_for_python(); if (ret != ret_ok) { PRINT_MSG ("ERROR: Couldn't find python.\n"); exit (EXIT_ERROR); } /* Signal handling */ act.sa_handler = SIG_IGN; sigaction (SIGPIPE, &act, NULL); memset(&act, 0, sizeof(act)); act.sa_sigaction = signals_handler; act.sa_flags = SA_SIGINFO; sigaction (SIGCHLD, &act, NULL); sigaction (SIGINT, &act, NULL); sigaction (SIGTERM, &act, NULL); /* Initialize the embedded server */ cherokee_init(); /* Seed random numbers */ cherokee_random_seed(); cherokee_spawner_set_active (false); process_parameters (argc, argv); ret = cherokee_server_new (&srv); if (ret != ret_ok) exit (EXIT_ERROR); ret = config_server (srv); if (ret != ret_ok) exit (EXIT_ERROR); ret = cherokee_server_initialize (srv); if (ret != ret_ok) exit (EXIT_ERROR); print_connection_info(); ret = cherokee_server_unlock_threads (srv); if (ret != ret_ok) exit (EXIT_ERROR); do { ret = cherokee_server_step (srv); } while (ret == ret_eagain); cherokee_server_stop (srv); cherokee_server_free (srv); cherokee_mrproper(); return EXIT_OK; }