void milter_manager_init (int *argc, char ***argv) { GOptionContext *option_context; GOptionGroup *milter_group; GError *error = NULL; MilterManager *manager; MilterManagerConfiguration *config; if (initialized) return; initialized = TRUE; setlocale(LC_ALL, ""); bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); milter_init(); milter_client_init(); milter_server_init(); milter_manager_log_handler_id = MILTER_GLIB_LOG_DELEGATE("milter-manager"); option_context = g_option_context_new(NULL); g_option_context_add_main_entries(option_context, option_entries, GETTEXT_PACKAGE); _milter_manager_configuration_init(); config = milter_manager_configuration_new(NULL); manager = milter_manager_new(config); g_object_unref(config); milter_group = milter_client_get_option_group(MILTER_CLIENT(manager)); g_option_context_add_group(option_context, milter_group); if (!g_option_context_parse(option_context, argc, argv, &error)) { g_print("%s\n", error->message); if (g_error_matches(error, G_OPTION_ERROR, G_OPTION_ERROR_UNKNOWN_OPTION)) { gchar *help; help = g_option_context_get_help(option_context, TRUE, NULL); g_print("\n%s", help); g_free(help); } g_error_free(error); g_option_context_free(option_context); g_object_unref(manager); exit(EXIT_FAILURE); } g_option_context_free(option_context); the_manager = manager; }
static void libmilter_compatible_initialize (void) { static gboolean initialized = FALSE; if (initialized) return; initialized = TRUE; milter_init(); }