diff src/config/main.c @ 9179:f8460b27db00 HEAD

doveconf: With -p only protocol-specific settings are returned. -n and -a return human-readable output.
author Timo Sirainen <tss@iki.fi>
date Thu, 30 Apr 2009 15:02:44 -0400
parents 6324a79d3ee1
children f155917f1615
line wrap: on
line diff
--- a/src/config/main.c	Thu Apr 30 14:48:54 2009 -0400
+++ b/src/config/main.c	Thu Apr 30 15:02:44 2009 -0400
@@ -1,26 +1,21 @@
 /* Copyright (C) 2005-2009 Dovecot authors, see the included COPYING file */
 
-#include "common.h"
+#include "lib.h"
 #include "array.h"
 #include "env-util.h"
 #include "master-service.h"
 #include "config-connection.h"
 #include "config-parser.h"
+#include "config-request.h"
 
 #include <stdlib.h>
 #include <unistd.h>
 
-ARRAY_TYPE(const_string) config_strings;
-
 static struct master_service *service;
-static pool_t config_pool;
 
 static void main_init(const char *service_name)
 {
-	config_pool = pool_alloconly_create("config parser", 10240);
-	p_array_init(&config_strings, config_pool, 256);
-	config_parse_file(config_pool, &config_strings,
-			  master_service_get_config_path(service),
+	config_parse_file(master_service_get_config_path(service),
 			  service_name);
 }
 
@@ -67,16 +62,16 @@
 
 	if (master_service_get_socket_count(service) > 0)
 		master_service_run(service, client_connected);
-	else if (exec_args == NULL)
-		config_connection_dump_request(STDOUT_FILENO, "master", flags);
-	else {
-		config_connection_putenv();
+	else if (exec_args == NULL) {
+		config_connection_dump_request(STDOUT_FILENO,
+					       service_name, flags);
+	} else {
+		config_connection_putenv(service_name);
 		env_put("DOVECONF_ENV=1");
 		execvp(exec_args[0], exec_args);
 		i_fatal("execvp(%s) failed: %m", exec_args[0]);
 	}
 	config_connections_destroy_all();
-	pool_unref(&config_pool);
 	master_service_deinit(&service);
         return 0;
 }