#include <sys_defs.h>
#include <msg.h>
#include <dict.h>
#include <vstream.h>
#include <mail_params.h>
#include <mail_conf.h>
#include <postconf.h>
static void pcf_flag_unused_parameters(DICT *dict, const char *conf_name,
PCF_MASTER_ENT *local_scope)
{
const char *myname = "pcf_flag_unused_parameters";
const char *param_name;
const char *param_value;
int how;
if (pcf_param_table == 0)
msg_panic("%s: global parameter table is not initialized", myname);
if (dict->sequence == 0)
msg_panic("%s: parameter dictionary %s has no iterator",
myname, conf_name);
for (how = DICT_SEQ_FUN_FIRST;
dict->sequence(dict, how, ¶m_name, ¶m_value) == 0;
how = DICT_SEQ_FUN_NEXT) {
if (PCF_PARAM_TABLE_LOCATE(pcf_param_table, param_name) == 0
&& (local_scope == 0
|| PCF_PARAM_TABLE_LOCATE(local_scope->valid_names, param_name) == 0)) {
vstream_fflush(VSTREAM_OUT);
msg_warn("%s/%s: unused parameter: %s=%s",
var_config_dir, conf_name, param_name, param_value);
}
}
}
void pcf_flag_unused_main_parameters(void)
{
const char *myname = "pcf_flag_unused_main_parameters";
DICT *dict;
if ((dict = dict_handle(CONFIG_DICT)) == 0)
msg_panic("%s: parameter dictionary %s not found",
myname, CONFIG_DICT);
pcf_flag_unused_parameters(dict, MAIN_CONF_FILE, (PCF_MASTER_ENT *) 0);
}
void pcf_flag_unused_master_parameters(void)
{
const char *myname = "pcf_flag_unused_master_parameters";
PCF_MASTER_ENT *masterp;
DICT *dict;
if (pcf_master_table == 0)
msg_panic("%s: master table is not initialized", myname);
for (masterp = pcf_master_table; masterp->argv != 0; masterp++)
if ((dict = masterp->all_params) != 0)
pcf_flag_unused_parameters(dict, MASTER_CONF_FILE, masterp);
}