dovecot-2.0-sslstream: doveconf -n: Don't show unchanged service...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:55:43 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/c94ca1acd623
changeset: 10196:c94ca1acd623
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 26 20:49:10 2009 -0400
description:
doveconf -n: Don't show unchanged service settings.

diffstat:

2 files changed, 15 insertions(+), 12 deletions(-)
src/config/config-request.c |    6 ++++++
src/config/doveconf.c       |   21 +++++++++------------

diffs (72 lines):

diff -r 40d8df2b4111 -r c94ca1acd623 src/config/config-request.c
--- a/src/config/config-request.c	Mon Oct 26 20:11:48 2009 -0400
+++ b/src/config/config-request.c	Mon Oct 26 20:49:10 2009 -0400
@@ -99,6 +99,12 @@ static void settings_export(struct setti
 			dump_default = FALSE;
 			break;
 		}
+		if (*((const char *)change_value) == 0) {
+			/* this is mainly for service {} blocks. if value
+			   hasn't changed, it's the default. even if
+			   info->defaults has a different value. */
+			default_value = value;
+		}
 
 		dump = FALSE;
 		count = 0;
diff -r 40d8df2b4111 -r c94ca1acd623 src/config/doveconf.c
--- a/src/config/doveconf.c	Mon Oct 26 20:11:48 2009 -0400
+++ b/src/config/doveconf.c	Mon Oct 26 20:49:10 2009 -0400
@@ -70,7 +70,7 @@ static void config_connection_request_hu
 	ARRAY_TYPE(uint) prefix_idx_stack;
 	struct config_request_get_string_ctx ctx;
 	const char *const *strings, *const *args, *p, *str, *const *prefixes;
-	const char *key, *value;
+	const char *key, *key2, *value;
 	unsigned int i, j, count, len, prefix_count, skip_len;
 	unsigned int indent = 0, prefix_idx = -1U;
 
@@ -103,6 +103,7 @@ static void config_connection_request_hu
 		key = t_strdup_until(strings[i], value);
 		value++;
 
+	again:
 		j = 0;
 		while (prefix_idx != -1U) {
 			len = strlen(prefixes[prefix_idx]);
@@ -111,28 +112,24 @@ static void config_connection_request_hu
 				indent--;
 				o_stream_send(output, ident_str, indent*2);
 				o_stream_send_str(output, "}\n");
-			} else if (strchr(key + len, '/') == NULL) {
+			} else {
 				/* keep the prefix */
-				j = prefix_count;
-				break;
-			} else {
-				/* subprefix */
+				j = prefix_idx + 1;
 				break;
 			}
 		}
 		for (; j < prefix_count; j++) {
 			len = strlen(prefixes[j]);
-			if (strncmp(prefixes[j], key, len) == 0 &&
-			    strchr(key + len, '/') == NULL) {
-				key += prefix_idx == -1U ? 0 :
-					strlen(prefixes[prefix_idx]);
+			if (strncmp(prefixes[j], key, len) == 0) {
+				key2 = key + (prefix_idx == -1U ? 0 :
+					      strlen(prefixes[prefix_idx]));
 				o_stream_send(output, ident_str, indent*2);
-				o_stream_send_str(output, t_strcut(key, '/'));
+				o_stream_send_str(output, t_strcut(key2, '/'));
 				o_stream_send_str(output, " {\n");
 				indent++;
 				prefix_idx = j;
 				array_append(&prefix_idx_stack, &prefix_idx, 1);
-				break;
+				goto again;
 			}
 		}
 		skip_len = prefix_idx == -1U ? 0 : strlen(prefixes[prefix_idx]);


More information about the dovecot-cvs mailing list