const char *
config_export_get_import_environment(struct config_export_context *ctx)
{
- enum setting_type stype;
- unsigned int i;
-
- for (i = 0; ctx->module_parsers[i].info != NULL; i++) {
- if (ctx->module_parsers[i].info == &master_service_setting_parser_info) {
- const char *key = "import_environment";
- const char *const *value =
- settings_parse_get_value(ctx->module_parsers[i].parser,
- &key, &stype);
- i_assert(value != NULL);
- return *value;
- }
- }
- i_unreached();
+ return config_module_parsers_get_setting(ctx->module_parsers,
+ "master_service", "import_environment");
}
const char *config_export_get_base_dir(struct config_export_context *ctx)
{
- enum setting_type stype;
- unsigned int i;
-
- for (i = 0; ctx->module_parsers[i].info != NULL; i++) {
- if (ctx->module_parsers[i].info == &master_service_setting_parser_info) {
- const char *key = "base_dir";
- const char *const *value =
- settings_parse_get_value(ctx->module_parsers[i].parser,
- &key, &stype);
- i_assert(value != NULL);
- return *value;
- }
- }
- i_unreached();
+ return config_module_parsers_get_setting(ctx->module_parsers,
+ "master_service", "base_dir");
}
void config_export_free(struct config_export_context **_ctx)
return ret;
}
-static const char *get_setting(const char *info_name, const char *name)
-{
- const struct config_module_parser *l;
- const struct setting_define *def;
- const char *const *value;
- const void *set;
-
- for (l = config_parsed_get_module_parsers(config); l->info != NULL; l++) {
- if (strcmp(l->info->name, info_name) != 0)
- continue;
-
- set = settings_parser_get_set(l->parser);
- for (def = l->info->defines; def->key != NULL; def++) {
- if (strcmp(def->key, name) == 0) {
- value = CONST_PTR_OFFSET(set, def->offset);
- return *value;
- }
- }
- }
- i_unreached();
-}
-
struct hostname_format {
const char *prefix, *suffix;
unsigned int numcount;
{
const char *base_dir, *symlink_path, *prev_path, *error;
- base_dir = get_setting("master_service", "base_dir");
+ base_dir = config_module_parsers_get_setting(
+ config_parsed_get_module_parsers(config),
+ "master_service", "base_dir");
symlink_path = t_strconcat(base_dir, "/"PACKAGE".conf", NULL);
if (t_readlink(symlink_path, &prev_path, &error) < 0) {
if (errno != ENOENT)
hide_key, hide_passwords);
}
} else {
- const char *info;
+ const char *info, *mail_location;
- info = sysinfo_get(get_setting("mail_storage", "mail_location"));
+ mail_location = config_module_parsers_get_setting(
+ config_parsed_get_module_parsers(config),
+ "mail_storage", "mail_location");
+ info = sysinfo_get(mail_location);
if (*info != '\0')
printf("# %s\n", info);
printf("# Hostname: %s\n", my_hostdomain());