23
23
/* const char *value;
25
25
/* void get_mail_conf_str_table(table)
26
/* CONFIG_STR_TABLE *table;
26
/* const CONFIG_STR_TABLE *table;
28
28
/* void get_mail_conf_str_fn_table(table)
29
/* CONFIG_STR_TABLE *table;
29
/* const CONFIG_STR_TABLE *table;
30
/* AUXILIARY FUNCTIONS
31
/* char *get_mail_conf_str2(name, suffix, defval, min, max)
33
/* const char *suffix;
34
/* const char *defval;
31
38
/* This module implements support for string-valued global
32
39
/* configuration parameters.
49
56
/* get_mail_conf_str_table() and get_mail_conf_str_fn_table() read
50
57
/* lists of variables, as directed by their table arguments. A table
51
58
/* must be terminated by a null entry.
60
/* get_mail_conf_str2() concatenates the two names and is otherwise
61
/* identical to get_mail_conf_str().
53
63
/* Fatal errors: bad string length.
97
108
/* get_mail_conf_str - evaluate string-valued configuration variable */
99
110
char *get_mail_conf_str(const char *name, const char *defval,
104
if ((strval = mail_conf_lookup_eval(name)) == 0) {
105
strval = mail_conf_eval(defval);
106
mail_conf_update(name, strval);
108
check_mail_conf_str(name, strval, min, max);
115
if ((strval = mail_conf_lookup_eval(name)) == 0) {
116
strval = mail_conf_eval(defval);
117
mail_conf_update(name, strval);
119
check_mail_conf_str(name, strval, min, max);
120
return (mystrdup(strval));
123
/* get_mail_conf_str2 - evaluate string-valued configuration variable */
125
char *get_mail_conf_str2(const char *name1, const char *name2,
132
name = concatenate(name1, name2, (char *) 0);
133
if ((strval = mail_conf_lookup_eval(name)) == 0) {
134
strval = mail_conf_eval(defval);
135
mail_conf_update(name, strval);
137
check_mail_conf_str(name, strval, min, max);
109
139
return (mystrdup(strval));
136
166
/* get_mail_conf_str_table - look up table of strings */
138
void get_mail_conf_str_table(CONFIG_STR_TABLE *table)
168
void get_mail_conf_str_table(const CONFIG_STR_TABLE *table)
140
170
while (table->name) {
141
171
if (table->target[0])
142
172
myfree(table->target[0]);
143
173
table->target[0] = get_mail_conf_str(table->name, table->defval,
144
table->min, table->max);
174
table->min, table->max);
149
179
/* get_mail_conf_str_fn_table - look up strings, defaults are functions */
151
void get_mail_conf_str_fn_table(CONFIG_STR_FN_TABLE *table)
181
void get_mail_conf_str_fn_table(const CONFIG_STR_FN_TABLE *table)
153
183
while (table->name) {
154
184
if (table->target[0])
155
185
myfree(table->target[0]);
156
186
table->target[0] = get_mail_conf_str_fn(table->name, table->defval,
157
table->min, table->max);
187
table->min, table->max);