Mercurial > dovecot > core-2.2
changeset 10195:c94ca1acd623 HEAD
doveconf -n: Don't show unchanged service settings.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 26 Oct 2009 20:49:10 -0400 |
parents | 40d8df2b4111 |
children | d647b795da6d |
files | src/config/config-request.c src/config/doveconf.c |
diffstat | 2 files changed, 15 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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;
--- 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 @@ 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 @@ key = t_strdup_until(strings[i], value); value++; + again: j = 0; while (prefix_idx != -1U) { len = strlen(prefixes[prefix_idx]); @@ -111,28 +112,24 @@ 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]);