dovecot-2.0: doveconf <key> now shows "key = " prefix, unless -h...

dovecot at dovecot.org dovecot at dovecot.org
Thu May 27 20:09:09 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/19730f396800
changeset: 11390:19730f396800
user:      Timo Sirainen <tss at iki.fi>
date:      Thu May 27 18:08:56 2010 +0100
description:
doveconf <key> now shows "key = " prefix, unless -h parameter is given.

diffstat:

 src/config/doveconf.c |  19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diffs (61 lines):

diff -r a0fccb6367f4 -r 19730f396800 src/config/doveconf.c
--- a/src/config/doveconf.c	Thu May 27 12:53:35 2010 +0100
+++ b/src/config/doveconf.c	Thu May 27 18:08:56 2010 +0100
@@ -392,7 +392,7 @@
 }
 
 static int
-config_dump_one(const struct config_filter *filter,
+config_dump_one(const struct config_filter *filter, bool hide_key,
 		enum config_dump_scope scope, const char *setting_name_filter)
 {
 	static struct config_dump_human_context *ctx;
@@ -408,7 +408,12 @@
 	array_foreach(&ctx->strings, str) {
 		if (strncmp(*str, setting_name_filter, len) == 0 &&
 		    (*str)[len] == '=') {
-			printf("%s\n", *str + len+1);
+			if (hide_key)
+				printf("%s\n", *str + len+1);
+			else {
+				printf("%s = %s\n", setting_name_filter,
+				       *str + len+1);
+			}
 			break;
 		}
 	}
@@ -491,12 +496,12 @@
 	const char *error, *setting_name_filter = NULL;
 	char **exec_args = NULL;
 	int c, ret, ret2;
-	bool config_path_specified, expand_vars = FALSE;
+	bool config_path_specified, expand_vars = FALSE, hide_key = FALSE;
 
 	memset(&filter, 0, sizeof(filter));
 	master_service = master_service_init("config",
 					     MASTER_SERVICE_FLAG_STANDALONE,
-					     &argc, &argv, "af:m:nNex");
+					     &argc, &argv, "af:hm:nNex");
 	orig_config_path = master_service_get_config_path(master_service);
 
 	i_set_failure_prefix("doveconf: ");
@@ -511,6 +516,9 @@
 		case 'f':
 			filter_parse_arg(&filter, optarg);
 			break;
+		case 'h':
+			hide_key = TRUE;
+			break;
 		case 'm':
 			module = optarg;
 			break;
@@ -559,7 +567,8 @@
 		i_fatal("%s", error);
 
 	if (setting_name_filter != NULL) {
-		ret2 = config_dump_one(&filter, scope, setting_name_filter);
+		ret2 = config_dump_one(&filter, hide_key, scope,
+				       setting_name_filter);
 	} else if (exec_args == NULL) {
 		const char *info;
 


More information about the dovecot-cvs mailing list