Rename default configuration file
The default configuration file name is "mailutils.conf". Legacy configuration file "mailutils.rc" is processed if necessary. * libmailutils/cli/cli.c: Rename main configuration file to mailutils.conf Remove 'rcfile' option aliases. (mu_cli_ext): Special handling for legacy configuration file. * NEWS: Update. * doc/texinfo/mailutils.texi: Update. * doc/texinfo/programs.texi: Update.
Showing
6 changed files
with
80 additions
and
37 deletions
1 | GNU mailutils NEWS -- history of user-visible changes. 2016-10-30 | 1 | GNU mailutils NEWS -- history of user-visible changes. 2016-11-02 |
2 | Copyright (C) 2002-2016 Free Software Foundation, Inc. | 2 | Copyright (C) 2002-2016 Free Software Foundation, Inc. |
3 | See the end of file for copying conditions. | 3 | See the end of file for copying conditions. |
4 | 4 | ||
... | @@ -39,6 +39,8 @@ programmers which use or wish to use Mailutils in their projects. | ... | @@ -39,6 +39,8 @@ programmers which use or wish to use Mailutils in their projects. |
39 | 39 | ||
40 | * Important changes | 40 | * Important changes |
41 | 41 | ||
42 | ** Main configuration file renamed to mailutils.conf | ||
43 | |||
42 | ** IPv6 support. | 44 | ** IPv6 support. |
43 | 45 | ||
44 | The core library as well as client and server utilities support | 46 | The core library as well as client and server utilities support | ... | ... |
... | @@ -154,23 +154,23 @@ Command Line | ... | @@ -154,23 +154,23 @@ Command Line |
154 | Mailutils Configuration File | 154 | Mailutils Configuration File |
155 | 155 | ||
156 | * conf-syntax:: Configuration File Syntax | 156 | * conf-syntax:: Configuration File Syntax |
157 | * Include:: Include Statement | 157 | * include:: Include Statement |
158 | * Logging Statement:: | 158 | * logging statement:: |
159 | * Debug Statement:: | 159 | * debug statement:: |
160 | * Mailbox Statement:: | 160 | * mailbox statement:: |
161 | * Locking Statement:: | 161 | * locking statement:: |
162 | * Mailer Statement:: | 162 | * mailer statement:: |
163 | * ACL Statement:: | 163 | * acl statement:: |
164 | * Tcp-wrappers Statement:: | 164 | * tcp-wrappers statement:: |
165 | * Server Settings:: | 165 | * Server Settings:: |
166 | * Auth Statement:: | 166 | * auth statement:: |
167 | * PAM Statement:: | 167 | * pam statement:: |
168 | * Virtdomain Statement:: | 168 | * virtdomain statement:: |
169 | * Radius Statement:: | 169 | * radius statement:: |
170 | * SQL Statement:: | 170 | * sql statement:: |
171 | * LDAP Statement:: | 171 | * ldap statement:: |
172 | * TLS Statement:: | 172 | * tls statement:: |
173 | * GSASL Statement:: | 173 | * gsasl statement:: |
174 | 174 | ||
175 | Configuration File Syntax | 175 | Configuration File Syntax |
176 | 176 | ... | ... |
This diff is collapsed.
Click to expand it.
... | @@ -18,6 +18,7 @@ | ... | @@ -18,6 +18,7 @@ |
18 | # include <config.h> | 18 | # include <config.h> |
19 | #endif | 19 | #endif |
20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
21 | #include <unistd.h> | ||
21 | #include <sysexits.h> | 22 | #include <sysexits.h> |
22 | #include <mailutils/cfg.h> | 23 | #include <mailutils/cfg.h> |
23 | #include <mailutils/opt.h> | 24 | #include <mailutils/opt.h> |
... | @@ -33,8 +34,10 @@ | ... | @@ -33,8 +34,10 @@ |
33 | #include <mailutils/syslog.h> | 34 | #include <mailutils/syslog.h> |
34 | #include <mailutils/mu_auth.h> | 35 | #include <mailutils/mu_auth.h> |
35 | 36 | ||
37 | #define MU_LEGACY_CONFIG_FILE SYSCONFDIR "/mailutils.rc" | ||
38 | |||
36 | #ifndef MU_SITE_CONFIG_FILE | 39 | #ifndef MU_SITE_CONFIG_FILE |
37 | # define MU_SITE_CONFIG_FILE SYSCONFDIR "/mailutils.rc" | 40 | # define MU_SITE_CONFIG_FILE SYSCONFDIR "/mailutils.conf" |
38 | #endif | 41 | #endif |
39 | 42 | ||
40 | char * | 43 | char * |
... | @@ -188,38 +191,61 @@ struct mu_option mu_common_options[] = { | ... | @@ -188,38 +191,61 @@ struct mu_option mu_common_options[] = { |
188 | MU_OPTION_END | 191 | MU_OPTION_END |
189 | }; | 192 | }; |
190 | 193 | ||
191 | struct mu_option mu_config_option_header = | 194 | /* This varibales are used to construct the set of configuration |
195 | handling options. | ||
196 | */ | ||
197 | |||
198 | /* Option group header */ | ||
199 | static struct mu_option mu_config_option_header = | ||
192 | MU_OPTION_GROUP (N_("Configuration handling")); | 200 | MU_OPTION_GROUP (N_("Configuration handling")); |
193 | 201 | ||
194 | struct mu_option mu_site_config_options[] = { | 202 | /* Disables site-wide configuration file */ |
203 | static struct mu_option mu_site_config_options[] = { | ||
195 | { "no-site-config", 0, NULL, MU_OPTION_IMMEDIATE, | 204 | { "no-site-config", 0, NULL, MU_OPTION_IMMEDIATE, |
196 | N_("do not load site-wide configuration file"), | 205 | N_("do not load site-wide configuration file"), |
197 | mu_c_string, NULL, no_site_config }, | 206 | mu_c_string, NULL, no_site_config }, |
198 | { "no-site-rcfile", 0, NULL, MU_OPTION_ALIAS }, | ||
199 | MU_OPTION_END | 207 | MU_OPTION_END |
200 | }; | 208 | }; |
201 | 209 | ||
202 | struct mu_option mu_no_config_option = { | 210 | /* Disables per-user configuration file */ |
211 | static struct mu_option mu_user_config_options[] = { | ||
212 | { "no-user-config", 0, NULL, MU_OPTION_IMMEDIATE, | ||
213 | N_("do not load user configuration file"), | ||
214 | mu_c_string, NULL, no_user_config }, | ||
215 | MU_OPTION_END | ||
216 | }; | ||
217 | |||
218 | /* 1. If both site-wide and per-user configuration files are used, | ||
219 | this option is equivalent to --no-site-config --no-user-config | ||
220 | used together. | ||
221 | 2. If only site-wide configuration is used, this option is an alias | ||
222 | to --no-site-config | ||
223 | 3. If only per-user configuration is used, this option is an alias | ||
224 | to --no-user-config | ||
225 | |||
226 | Thus, --no-config-option always disables parsing of the default | ||
227 | configuration files. | ||
228 | */ | ||
229 | static struct mu_option mu_no_config_option = { | ||
203 | "no-config", 0, NULL, MU_OPTION_IMMEDIATE, | 230 | "no-config", 0, NULL, MU_OPTION_IMMEDIATE, |
204 | N_("do not load site and user configuration files"), | 231 | N_("do not load site and user configuration files"), |
205 | mu_c_string, NULL, no_config | 232 | mu_c_string, NULL, no_config |
206 | }; | 233 | }; |
207 | 234 | ||
208 | struct mu_option mu_config_options[] = { | 235 | /* These options are always available for utilities that use at least |
236 | one of default configuration files */ | ||
237 | static struct mu_option mu_config_options[] = { | ||
209 | { "config-file", 0, N_("FILE"), MU_OPTION_IMMEDIATE, | 238 | { "config-file", 0, N_("FILE"), MU_OPTION_IMMEDIATE, |
210 | N_("load this configuration file; implies --no-config"), | 239 | N_("load this configuration file; implies --no-config"), |
211 | mu_c_string, NULL, config_file }, | 240 | mu_c_string, NULL, config_file }, |
212 | { "rcfile", 0, NULL, MU_OPTION_ALIAS }, | ||
213 | 241 | ||
214 | { "config-verbose", 0, NULL, MU_OPTION_IMMEDIATE, | 242 | { "config-verbose", 0, NULL, MU_OPTION_IMMEDIATE, |
215 | N_("verbosely log parsing of the configuration files"), | 243 | N_("verbosely log parsing of the configuration files"), |
216 | mu_c_string, NULL, config_verbose }, | 244 | mu_c_string, NULL, config_verbose }, |
217 | { "rcfile-verbose", 0, NULL, MU_OPTION_ALIAS }, | ||
218 | 245 | ||
219 | { "config-lint", 0, NULL, MU_OPTION_IMMEDIATE, | 246 | { "config-lint", 0, NULL, MU_OPTION_IMMEDIATE, |
220 | N_("check configuration file syntax and exit"), | 247 | N_("check configuration file syntax and exit"), |
221 | mu_c_string, NULL, config_lint }, | 248 | mu_c_string, NULL, config_lint }, |
222 | { "rcfile-lint", 0, NULL, MU_OPTION_ALIAS }, | ||
223 | 249 | ||
224 | { "set", 0, N_("PARAM=VALUE"), MU_OPTION_IMMEDIATE, | 250 | { "set", 0, N_("PARAM=VALUE"), MU_OPTION_IMMEDIATE, |
225 | N_("set configuration parameter"), | 251 | N_("set configuration parameter"), |
... | @@ -228,13 +254,6 @@ struct mu_option mu_config_options[] = { | ... | @@ -228,13 +254,6 @@ struct mu_option mu_config_options[] = { |
228 | MU_OPTION_END | 254 | MU_OPTION_END |
229 | }; | 255 | }; |
230 | 256 | ||
231 | struct mu_option mu_user_config_options[] = { | ||
232 | { "no-user-config", 0, NULL, MU_OPTION_IMMEDIATE, | ||
233 | N_("do not load user configuration file"), | ||
234 | mu_c_string, NULL, no_user_config }, | ||
235 | { "no-user-rcfile", 0, NULL, MU_OPTION_ALIAS }, | ||
236 | MU_OPTION_END | ||
237 | }; | ||
238 | 257 | ||
239 | static void | 258 | static void |
240 | show_comp_defaults (struct mu_parseopt *po, struct mu_option *opt, | 259 | show_comp_defaults (struct mu_parseopt *po, struct mu_option *opt, |
... | @@ -607,6 +626,29 @@ mu_cli_ext (int argc, char **argv, | ... | @@ -607,6 +626,29 @@ mu_cli_ext (int argc, char **argv, |
607 | else if (argc) | 626 | else if (argc) |
608 | mu_parseopt_error (&po, "%s", _("unexpected arguments")); | 627 | mu_parseopt_error (&po, "%s", _("unexpected arguments")); |
609 | 628 | ||
629 | #if defined(MU_LEGACY_CONFIG_FILE) | ||
630 | if ((hints.flags & MU_CFHINT_SITE_FILE) | ||
631 | && strcmp (hints.site_file, MU_SITE_CONFIG_FILE) == 0) | ||
632 | { | ||
633 | if (access (MU_LEGACY_CONFIG_FILE, F_OK) == 0) | ||
634 | { | ||
635 | if (access (hints.site_file, F_OK) == 0) | ||
636 | { | ||
637 | mu_diag_output (MU_DIAG_WARNING, | ||
638 | _("legacy configuration file %s ignored"), | ||
639 | MU_LEGACY_CONFIG_FILE); | ||
640 | } | ||
641 | else | ||
642 | { | ||
643 | mu_diag_output (MU_DIAG_WARNING, | ||
644 | _("using legacy configuration file %s: please rename it to %s"), | ||
645 | MU_LEGACY_CONFIG_FILE, MU_SITE_CONFIG_FILE); | ||
646 | hints.site_file = MU_LEGACY_CONFIG_FILE; | ||
647 | } | ||
648 | } | ||
649 | } | ||
650 | #endif | ||
651 | |||
610 | if (mu_cfg_parse_config (&parse_tree, &hints)) | 652 | if (mu_cfg_parse_config (&parse_tree, &hints)) |
611 | exit (setup->ex_config); | 653 | exit (setup->ex_config); |
612 | 654 | ... | ... |
... | @@ -21,7 +21,7 @@ dnl testcompile(SCRIPT) -- test compilation of the Sieve SCRIPT | ... | @@ -21,7 +21,7 @@ dnl testcompile(SCRIPT) -- test compilation of the Sieve SCRIPT |
21 | dnl | 21 | dnl |
22 | m4_define([testcompile],[ | 22 | m4_define([testcompile],[ |
23 | AT_SETUP([compile $1]) | 23 | AT_SETUP([compile $1]) |
24 | AT_CHECK([sieve -c $abs_top_srcdir/sieve/examples/$1], | 24 | AT_CHECK([sieve MUT_SIEVE_DEFAULT_OPTIONS -c $abs_top_srcdir/sieve/examples/$1], |
25 | [0]) | 25 | [0]) |
26 | AT_CLEANUP | 26 | AT_CLEANUP |
27 | ]) | 27 | ]) | ... | ... |
... | @@ -24,8 +24,7 @@ dnl ------------------------------------------------------------ | ... | @@ -24,8 +24,7 @@ dnl ------------------------------------------------------------ |
24 | dnl MUT_DEFAULT_OPTIONS -- produce default command line options | 24 | dnl MUT_DEFAULT_OPTIONS -- produce default command line options |
25 | dnl ------------------------------------------------------------ | 25 | dnl ------------------------------------------------------------ |
26 | m4_define([MUT_DEFAULT_OPTIONS],[dnl | 26 | m4_define([MUT_DEFAULT_OPTIONS],[dnl |
27 | --no-site-config dnl | 27 | --no-config dnl |
28 | --no-user-config dnl | ||
29 | --set '.mailbox.mailbox-type=mbox' dnl | 28 | --set '.mailbox.mailbox-type=mbox' dnl |
30 | ]) | 29 | ]) |
31 | 30 | ... | ... |
-
Please register or sign in to post a comment