Esempio n. 1
0
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;
}
Esempio n. 2
0
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;
}