diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-11-02 12:06:08 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-11-02 12:06:08 +0200 |
commit | dc62b3998f0fe8ce0f131e269b130831093264fb (patch) | |
tree | a6b27a403088ab5252388c5891e5fd3ef1fcc9f4 /include | |
parent | b4c787e6ea89ba0005845925cc33070a264d2a77 (diff) | |
download | mailutils-dc62b3998f0fe8ce0f131e269b130831093264fb.tar.gz mailutils-dc62b3998f0fe8ce0f131e269b130831093264fb.tar.bz2 |
Improve configuration file handling.
* include/mailutils/cfg.h (mu_cfg_parse_hints):
Rename site_rcfile to site_file, custom_rcfile to custom_file.
Remove append_tree and data fields.
(MU_PARSE_CONFIG_GLOBAL,MU_CFG_PARSE_PROGRAM): Remove.
(MU_PARSE_CONFIG_VERBOSE): Rename to MU_CF_VERBOSE.
(MU_PARSE_CONFIG_DUMP): Rename to MU_CF_DUMP.
(MU_CFG_FMT_LOCUS): Rename to MU_CF_FMT_LOCUS.
(MU_CFG_FMT_VALUE_ONLY): Rename to MU_CF_FMT_VALUE_ONLY.
(MU_CFG_FMT_PARAM_PATH): Rename to MU_CF_FMT_PARAM_PATH.
(MU_CFG_COMPATIBILITY,MU_CFG_DEPRECATED): Remove.
(mu_parse_config, mu_get_config): Remove deprecated functions.
* libmailutils/cli/cli.c (mu_general_help_text): New global.
(app_data): New struct.
(init_options): Construct configuration option group depending on
which configuration files are in use.
(mu_cli_ext): Don't use per-user configuration files for servers.
Pass pointer to app_data structure as po.po_data
(mu_cli): Set MU_CFHINT_PER_USER_FILE flag by default.
* mail/testsuite/lib/mail.exp: Rewrite invocation of the mu_init command.
* include/mailutils/cli.h (mu_cli_setup) <server>: New field.
* comsat/comsat.c (cli): Mark as server.
(main): Bugfix: pass pointer to server to mu_cli.
* imap4d/imap4d.c (cli): Mark as server.
* pop3d/pop3d.c: Likewise.
* comsat/tests/testsuite.at: Use the --no-site-config
option.
* imap4d/tests/testsuite.at: Likewise.
* libmailutils/cfg/driver.c: Update.
* libmailutils/cfg/format.c: Update.
* libmailutils/cfg/lexer.l: Update.
* libmailutils/cfg/parser.y: Update.
* mu/acl.c: Update.
* pop3d/testsuite/lib/pop3d.exp: Likewise.
* mu/mu.c: Don't read configuration files.
* mu/query.c: Fix args_doc
* testsuite/lib/mailutils.exp (mu_init): Change option handling.
Set --no-config option by default.
Diffstat (limited to 'include')
-rw-r--r-- | include/mailutils/cfg.h | 65 | ||||
-rw-r--r-- | include/mailutils/cli.h | 5 |
2 files changed, 35 insertions, 35 deletions
diff --git a/include/mailutils/cfg.h b/include/mailutils/cfg.h index 1a69c82cb..9b8e951f8 100644 --- a/include/mailutils/cfg.h +++ b/include/mailutils/cfg.h @@ -72,17 +72,43 @@ struct mu_cfg_node mu_list_t nodes; /* a list of mu_cfg_node_t */ struct mu_cfg_node *parent; /* parent node */ }; - + struct mu_cfg_parse_hints { int flags; - char *site_rcfile; - char *custom_rcfile; + char *site_file; + char *custom_file; char *program; - struct mu_cfg_tree *append_tree; - void *data; }; +/* Bit constants for the flags field of struct mu_cfg_parse_hints */ +/* Parse site-wide configuration file hints.site_file */ +#define MU_CFHINT_SITE_FILE 0x0001 +/* Parse custom configuration file hints.custom_file */ +#define MU_CFHINT_CUSTOM_FILE 0x0002 +/* The hints.program field is set. The "program PROGNAME" section + will be processed, if PROGNAME is the same as hints.program. + If include statement is used with the directory name DIR as its + argument, the file DIR/PROGNAME will be looked up and read in, + if it exists. */ +#define MU_CFHINT_PROGRAM 0x0004 + +/* If MU_CFHINT_PROGRAM is set, look for the file ~/.PROGNAME after parsing + site-wide configuration */ +#define MU_CFHINT_PER_USER_FILE 0x0008 + +/* Verbosely log files being processed */ +#define MU_CF_VERBOSE 0x0010 +/* Dump the pare tree on stderr */ +#define MU_CF_DUMP 0x0020 + +/* Format location of the statement */ +#define MU_CF_FMT_LOCUS 0x0100 +/* Print only value */ +#define MU_CF_FMT_VALUE_ONLY 0x0200 +/* Print full parameter path */ +#define MU_CF_FMT_PARAM_PATH 0x0400 + struct mu_cfg_tree { mu_list_t nodes; /* a list of mu_cfg_node_t */ @@ -140,9 +166,6 @@ struct mu_cfg_param const char *argname; }; -#define MU_TARGET_REF(f) &f, 0 -#define MU_TARGET_OFF(s,f) NULL, mu_offsetof(s,f) - enum mu_cfg_section_stage { mu_cfg_section_start, @@ -230,29 +253,7 @@ int mu_config_register_plain_section (const char *parent_path, const char *ident, struct mu_cfg_param *params); -#define MU_PARSE_CONFIG_GLOBAL 0x001 -#define MU_PARSE_CONFIG_VERBOSE 0x002 -#define MU_PARSE_CONFIG_DUMP 0x004 -#define MU_PARSE_CONFIG_PLAIN 0x008 -#define MU_CFG_PARSE_SITE_RCFILE 0x010 -#define MU_CFG_PARSE_CUSTOM_RCFILE 0x020 -#define MU_CFG_PARSE_PROGRAM 0x040 -#define MU_CFG_FMT_LOCUS 0x080 -#define MU_CFG_FMT_VALUE_ONLY 0x100 -#define MU_CFG_FMT_PARAM_PATH 0x200 -#define MU_PARSE_CONFIG_LINT 0x400 -#define MU_CFG_APPEND_TREE 0x800 -#ifdef MU_CFG_COMPATIBILITY -# define MU_CFG_DEPRECATED -#else -# define MU_CFG_DEPRECATED MU_DEPRECATED -#endif - -int mu_parse_config (const char *file, const char *progname, - struct mu_cfg_param *progparam, int flags, - void *target_ptr) MU_CFG_DEPRECATED; - extern int mu_cfg_parser_verbose; extern size_t mu_cfg_error_count; @@ -279,10 +280,6 @@ int mu_cfg_parse_file (mu_cfg_tree_t **return_tree, const char *file, int flags); -int mu_get_config (const char *file, const char *progname, - struct mu_cfg_param *progparam, int flags, - void *target_ptr) MU_CFG_DEPRECATED; - int mu_cfg_tree_create (struct mu_cfg_tree **ptree); mu_cfg_node_t *mu_cfg_tree_create_node (struct mu_cfg_tree *tree, enum mu_cfg_node_type type, diff --git a/include/mailutils/cli.h b/include/mailutils/cli.h index eaf0f8d58..b2ed7ce48 100644 --- a/include/mailutils/cli.h +++ b/include/mailutils/cli.h @@ -50,11 +50,14 @@ struct mu_cli_setup int ex_usage; /* If not 0, exit code on usage errors */ int ex_config; /* If not 0, exit code on configuration errors */ - int inorder; + int inorder:1; /* Don't permute options and arguments */ + int server:1; /* This is a server: don't read per-user + configuration files */ void (*prog_doc_hook) (mu_stream_t); }; extern const char mu_version_copyright[]; +extern const char mu_general_help_text[]; void mu_version_hook (struct mu_parseopt *po, mu_stream_t stream); void mu_cli (int argc, char **argv, struct mu_cli_setup *setup, |