dovecot-2.0: doveadm: Moved -s parameter among -u/-A parameters,...

dovecot at dovecot.org dovecot at dovecot.org
Tue Nov 23 21:07:23 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/66428c763354
changeset: 12467:66428c763354
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Nov 23 19:07:19 2010 +0000
description:
doveadm: Moved -s parameter among -u/-A parameters, since it's only used by mail commands.

diffstat:

 src/doveadm/doveadm-mail.c     |   7 ++++++-
 src/doveadm/doveadm-settings.c |   2 +-
 src/doveadm/doveadm-settings.h |   2 +-
 src/doveadm/doveadm.c          |  32 +++++++-------------------------
 4 files changed, 15 insertions(+), 28 deletions(-)

diffs (131 lines):

diff -r 21966f298a3c -r 66428c763354 src/doveadm/doveadm-mail.c
--- a/src/doveadm/doveadm-mail.c	Tue Nov 23 18:42:27 2010 +0000
+++ b/src/doveadm/doveadm-mail.c	Tue Nov 23 19:07:19 2010 +0000
@@ -372,7 +372,7 @@
 
 	ctx = doveadm_mail_cmd_init(cmd);
 
-	getopt_args = t_strconcat("Au:", ctx->getopt_args, NULL);
+	getopt_args = t_strconcat("As:u:", ctx->getopt_args, NULL);
 	username = getenv("USER");
 	wildcard_user = NULL;
 	while ((c = getopt(argc, argv, getopt_args)) > 0) {
@@ -380,6 +380,11 @@
 		case 'A':
 			ctx->iterate_all_users = TRUE;
 			break;
+		case 's':
+			doveadm_settings->doveadm_socket_path = optarg;
+			if (doveadm_settings->doveadm_worker_count == 0)
+				doveadm_settings->doveadm_worker_count = 1;
+			break;
 		case 'u':
 			service_flags |=
 				MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP;
diff -r 21966f298a3c -r 66428c763354 src/doveadm/doveadm-settings.c
--- a/src/doveadm/doveadm-settings.c	Tue Nov 23 18:42:27 2010 +0000
+++ b/src/doveadm/doveadm-settings.c	Tue Nov 23 19:07:19 2010 +0000
@@ -91,7 +91,7 @@
 	.dependencies = doveadm_setting_dependencies
 };
 
-const struct doveadm_settings *doveadm_settings;
+struct doveadm_settings *doveadm_settings;
 
 static void
 fix_base_path(struct doveadm_settings *set, pool_t pool, const char **str)
diff -r 21966f298a3c -r 66428c763354 src/doveadm/doveadm-settings.h
--- a/src/doveadm/doveadm-settings.h	Tue Nov 23 18:42:27 2010 +0000
+++ b/src/doveadm/doveadm-settings.h	Tue Nov 23 19:07:19 2010 +0000
@@ -12,6 +12,6 @@
 };
 
 extern const struct setting_parser_info doveadm_setting_parser_info;
-extern const struct doveadm_settings *doveadm_settings;
+extern struct doveadm_settings *doveadm_settings;
 
 #endif
diff -r 21966f298a3c -r 66428c763354 src/doveadm/doveadm.c
--- a/src/doveadm/doveadm.c	Tue Nov 23 18:42:27 2010 +0000
+++ b/src/doveadm/doveadm.c	Tue Nov 23 19:07:19 2010 +0000
@@ -221,7 +221,7 @@
 	return doveadm_mail_has_subcommands(cmd_name);
 }
 
-static void doveadm_read_settings(const char *socket_path)
+static void doveadm_read_settings(void)
 {
 	static const struct setting_parser_info *set_roots[] = {
 		&doveadm_setting_parser_info,
@@ -229,6 +229,7 @@
 	};
 	struct master_service_settings_input input;
 	struct master_service_settings_output output;
+	const struct doveadm_settings *set;
 	const char *error;
 
 	memset(&input, 0, sizeof(input));
@@ -239,24 +240,8 @@
 					 &output, &error) < 0)
 		i_fatal("Error reading configuration: %s", error);
 
-	doveadm_settings = master_service_settings_get_others(master_service)[0];
-	if (socket_path != NULL) {
-		struct setting_parser_context *set_parser =
-			master_service_get_settings_parser(master_service);
-		const char *set_line =
-			t_strconcat("doveadm_socket_path=", socket_path, NULL);
-
-		if (settings_parse_line(set_parser, set_line) < 0)
-			i_unreached();
-		if (doveadm_settings->doveadm_worker_count == 0) {
-			if (settings_parse_line(set_parser,
-						"doveadm_worker_count=1") < 0)
-				i_unreached();
-		}
-	}
-
-	doveadm_settings = settings_dup(&doveadm_setting_parser_info,
-					doveadm_settings,
+	set = master_service_settings_get_others(master_service)[0];
+	doveadm_settings = settings_dup(&doveadm_setting_parser_info, set,
 					pool_datastack_create());
 }
 
@@ -282,7 +267,7 @@
 	enum master_service_flags service_flags =
 		MASTER_SERVICE_FLAG_STANDALONE |
 		MASTER_SERVICE_FLAG_KEEP_CONFIG_OPEN;
-	const char *cmd_name, *socket_path = NULL;
+	const char *cmd_name;
 	unsigned int i;
 	bool quick_init = FALSE;
 	int c;
@@ -290,7 +275,7 @@
 	/* "+" is GNU extension to stop at the first non-option.
 	   others just accept -+ option. */
 	master_service = master_service_init("doveadm", service_flags,
-					     &argc, &argv, "+Df:s:v");
+					     &argc, &argv, "+Df:v");
 	while ((c = master_getopt(master_service)) > 0) {
 		switch (c) {
 		case 'D':
@@ -300,9 +285,6 @@
 		case 'f':
 			doveadm_print_init(optarg);
 			break;
-		case 's':
-			socket_path = optarg;
-			break;
 		case 'v':
 			doveadm_verbose = TRUE;
 			break;
@@ -317,7 +299,7 @@
 		/* "help cmd" doesn't need any configuration */
 		quick_init = TRUE;
 	} else {
-		doveadm_read_settings(socket_path);
+		doveadm_read_settings();
 	}
 
 	i_array_init(&doveadm_cmds, 32);


More information about the dovecot-cvs mailing list