From d581fe1755bcfc0f42020178376ec65e2f8ced4b Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 27 Sep 2010 16:46:26 +0100 Subject: [PATCH] doveconf: Expand "key=$key" variable even without -x parameter. Without this expansion it hides what the settings actually contain. --- src/config/config-parser.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/config/config-parser.c b/src/config/config-parser.c index 41de835f96..db114b5fce 100644 --- a/src/config/config-parser.c +++ b/src/config/config-parser.c @@ -663,18 +663,20 @@ static int config_write_value(struct config_parser_context *ctx, } break; case CONFIG_LINE_TYPE_KEYVARIABLE: - if (!ctx->expand_values) { + /* expand_parent=TRUE for "key = $key stuff". + we'll always expand it so that doveconf -n can give + usable output */ + p = strchr(value, ' '); + if (p == NULL) + var_name = value; + else + var_name = t_strdup_until(value, p); + expand_parent = strcmp(key, var_name) == 0; + + if (!ctx->expand_values && !expand_parent) { str_append_c(str, '$'); str_append(str, value); } else { - p = strchr(value, ' '); - if (p == NULL) - var_name = value; - else - var_name = t_strdup_until(value, p); - - /* expand_parent=TRUE for "key = $key stuff" */ - expand_parent = strcmp(key, var_name) == 0; var_value = config_get_value(ctx->cur_section, var_name, expand_parent, &var_type); if (var_value == NULL) { -- 2.47.3