Commit dc62b399 dc62b3998f0fe8ce0f131e269b130831093264fb by Sergey Poznyakoff

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.
1 parent b4c787e6
......@@ -194,11 +194,11 @@ struct mu_cfg_param comsat_cfg_param[] = {
static char const *alt_args[] = { N_("--test MBOX-URL MSG-QID"), NULL };
static struct mu_cli_setup cli = {
options,
comsat_cfg_param,
N_("GNU comsatd -- notify users about incoming mail"),
"",
alt_args,
.optv = options,
.cfg =comsat_cfg_param,
.prog_doc = N_("GNU comsatd -- notify users about incoming mail"),
.prog_alt_args = alt_args,
.server = 1
};
static char *capa[] = {
......@@ -568,7 +568,7 @@ main (int argc, char **argv)
save_argv = argv;
mu_cli (argc, argv, &cli, capa, NULL, &argc, &argv);
mu_cli (argc, argv, &cli, capa, server, &argc, &argv);
if (test_mode)
{
......
......@@ -22,7 +22,7 @@ m4_pushdef([BIFF_MBOX],[`pwd`/mailbox])
dnl ------------------------------------------------------------
dnl comsatcmd
m4_pushdef([comsatcmd],[comsatd --no-site --no-user --file ./biff.rc dnl
m4_pushdef([comsatcmd],[comsatd --no-site-config --file ./biff.rc dnl
--set logging.syslog=no --test])
dnl ------------------------------------------------------------
......
......@@ -449,9 +449,10 @@ static struct mu_cfg_param imap4d_cfg_param[] = {
};
struct mu_cli_setup cli = {
options,
imap4d_cfg_param,
N_("GNU imap4d -- the IMAP4D daemon.")
.optv = options,
.cfg = imap4d_cfg_param,
.prog_doc = N_("GNU imap4d -- the IMAP4D daemon."),
.server = 1
};
int
......@@ -659,7 +660,7 @@ get_client_address (int fd, struct sockaddr_in *pcs)
}
static int
set_strerr_flt ()
set_strerr_flt (void)
{
mu_stream_t flt, trans[2];
int rc;
......@@ -700,7 +701,7 @@ set_strerr_flt ()
}
static void
clr_strerr_flt ()
clr_strerr_flt (void)
{
mu_stream_t flt, trans[2];
int rc;
......
......@@ -20,7 +20,6 @@ m4_define([IMAP4D_HOMEDIR])
m4_define([IMAP4D_DEFAULT_OPTIONS],[dnl
--no-site-config dnl
--no-user-config dnl
--test dnl
--set logging.syslog=0 dnl
--set logging.severity=notice dnl
......
......@@ -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,
......
......@@ -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,
......
......@@ -27,7 +27,6 @@
#include <ctype.h>
#include <mailutils/argcv.h>
#include <mailutils/nls.h>
#define MU_CFG_COMPATIBILITY /* This source uses deprecated cfg interfaces */
#include <mailutils/cfg.h>
#include <mailutils/errno.h>
#include <mailutils/error.h>
......@@ -466,14 +465,14 @@ mu_cfg_tree_reduce (mu_cfg_tree_t *parse_tree,
struct mu_cfg_cont *cont;
if (!parse_tree)
return 0;
if (hints && (hints->flags & MU_PARSE_CONFIG_DUMP))
if (hints && (hints->flags & MU_CF_DUMP))
{
int yes = 1;
mu_stream_t stream;
mu_stdio_stream_create (&stream, MU_STDERR_FD, 0);
mu_stream_ioctl (stream, MU_IOCTL_FD, MU_IOCTL_FD_SET_BORROW, &yes);
mu_cfg_format_parse_tree (stream, parse_tree, MU_CFG_FMT_LOCUS);
mu_cfg_format_parse_tree (stream, parse_tree, MU_CF_FMT_LOCUS);
mu_stream_destroy (&stream);
}
......@@ -492,29 +491,6 @@ mu_format_config_tree (mu_stream_t stream, struct mu_cfg_param *progparam)
mu_config_destroy_container (&cont);
}
int
mu_parse_config (const char *file, const char *progname,
struct mu_cfg_param *progparam, int flags,
void *target_ptr)
{
int rc;
char *full_name = mu_tilde_expansion (file, MU_HIERARCHY_DELIMITER, NULL);
if (full_name)
{
if (access (full_name, R_OK) == 0)
{
rc = mu_get_config (full_name, progname, progparam, flags,
target_ptr);
}
else
rc = ENOENT;
free (full_name);
}
else
rc = ENOMEM;
return rc;
}
static const char *
_first_value_ptr (mu_config_value_t *val)
{
......
......@@ -152,7 +152,7 @@ format_node (const mu_cfg_node_t *node, void *data)
{
struct tree_print *tp = data;
if ((tp->flags & MU_CFG_FMT_LOCUS) && node->locus.mu_file)
if ((tp->flags & MU_CF_FMT_LOCUS) && node->locus.mu_file)
mu_stream_printf (tp->stream, "# %lu \"%s\"\n",
(unsigned long) node->locus.mu_line,
node->locus.mu_file);
......@@ -165,7 +165,7 @@ format_node (const mu_cfg_node_t *node, void *data)
break;
case mu_cfg_node_statement:
if (tp->flags & MU_CFG_FMT_PARAM_PATH)
if (tp->flags & MU_CF_FMT_PARAM_PATH)
return MU_CFG_ITER_OK;
else
{
......@@ -181,9 +181,9 @@ format_node (const mu_cfg_node_t *node, void *data)
break;
case mu_cfg_node_param:
if (tp->flags & MU_CFG_FMT_VALUE_ONLY)
if (tp->flags & MU_CF_FMT_VALUE_ONLY)
format_value (tp, node->label);
else if (tp->flags & MU_CFG_FMT_PARAM_PATH)
else if (tp->flags & MU_CF_FMT_PARAM_PATH)
{
format_path (tp, node, ':');
mu_stream_write (tp->stream, " ", 1, NULL);
......@@ -209,7 +209,7 @@ static int
format_node_end (const mu_cfg_node_t *node, void *data)
{
struct tree_print *tp = data;
if (!(tp->flags & MU_CFG_FMT_PARAM_PATH))
if (!(tp->flags & MU_CF_FMT_PARAM_PATH))
{
tp->level--;
format_level (tp->stream, tp->level);
......@@ -242,7 +242,7 @@ mu_cfg_format_node (mu_stream_t stream, const mu_cfg_node_t *node, int flags)
struct tree_print t;
if (node->type == mu_cfg_node_statement)
flags &= ~MU_CFG_FMT_VALUE_ONLY;
flags &= ~MU_CF_FMT_VALUE_ONLY;
t.flags = flags;
t.level = 0;
t.stream = stream;
......
......@@ -330,14 +330,14 @@ mu_cfg_parse_file (mu_cfg_tree_t **return_tree, const char *file, int flags)
int rc;
char *full_name = mu_tilde_expansion (file, MU_HIERARCHY_DELIMITER, NULL);
if (flags & MU_PARSE_CONFIG_VERBOSE)
if (flags & MU_CF_VERBOSE)
mu_diag_output (MU_DIAG_INFO, _("opening configuration file %s"),
full_name);
if (stat (full_name, &st))
{
if (errno != ENOENT)
mu_error (_("cannot stat `%s': %s"), full_name, mu_strerror (errno));
else if (flags & MU_PARSE_CONFIG_VERBOSE)
else if (flags & MU_CF_VERBOSE)
mu_diag_output (MU_DIAG_INFO, _("configuration file %s doesn't exist"),
full_name);
free (full_name);
......@@ -345,7 +345,7 @@ mu_cfg_parse_file (mu_cfg_tree_t **return_tree, const char *file, int flags)
}
else if (!S_ISREG (st.st_mode))
{
if (flags & MU_PARSE_CONFIG_VERBOSE)
if (flags & MU_CF_VERBOSE)
mu_diag_output (MU_DIAG_INFO, _("%s: not a regular file"), full_name);
free (full_name);
return ENOENT;
......@@ -360,7 +360,7 @@ mu_cfg_parse_file (mu_cfg_tree_t **return_tree, const char *file, int flags)
return errno;
}
if (flags & MU_PARSE_CONFIG_VERBOSE)
if (flags & MU_CF_VERBOSE)
mu_diag_output (MU_DIAG_INFO, _("parsing file `%s'"), full_name);
mu_cfg_set_lex_debug ();
......@@ -379,37 +379,13 @@ mu_cfg_parse_file (mu_cfg_tree_t **return_tree, const char *file, int flags)
yyrestart (fp);
rc = mu_cfg_parse (return_tree);
fclose (fp);
if (flags & MU_PARSE_CONFIG_VERBOSE)
if (flags & MU_CF_VERBOSE)
mu_diag_output (MU_DIAG_INFO, _("finished parsing file `%s'"),
mu_cfg_locus.mu_file);
return rc == 0 ? 0 : MU_ERR_FAILURE;
}
/* FIXME: Deprecated interface */
int
mu_get_config (const char *file, const char *progname,
struct mu_cfg_param *progparam, int flags, void *target_ptr)
{
mu_cfg_tree_t *parse_tree;
int rc = mu_cfg_parse_file (&parse_tree, file, flags);
if (rc == 0)
{
struct mu_cfg_parse_hints hints;
hints.flags = flags | MU_CFG_PARSE_PROGRAM;
hints.program = (char*)progname;
rc = mu_cfg_tree_postprocess (parse_tree, &hints);
if (rc == 0)
rc = mu_cfg_tree_reduce (parse_tree, &hints, progparam, target_ptr);
mu_cfg_destroy_tree (&parse_tree);
}
return rc == 0 ? 0 : MU_ERR_FAILURE;
}
mu_opool_t
mu_cfg_lexer_pool ()
{
......
......@@ -501,8 +501,7 @@ do_include (const char *name, struct mu_cfg_parse_hints *hints,
if (S_ISDIR (sb.st_mode))
{
if ((hints->flags & (MU_PARSE_CONFIG_GLOBAL|MU_CFG_PARSE_PROGRAM)) ==
(MU_PARSE_CONFIG_GLOBAL|MU_CFG_PARSE_PROGRAM))
if (hints->flags & MU_CFHINT_PROGRAM)
{
char *file = mu_make_file_name (name, hints->program);
rc = mu_cfg_parse_file (&tree, file, hints->flags);
......@@ -515,7 +514,7 @@ do_include (const char *name, struct mu_cfg_parse_hints *hints,
if (rc == 0 && tree)
{
struct mu_cfg_parse_hints xhints = *hints;
xhints.flags &= ~MU_PARSE_CONFIG_GLOBAL;
xhints.flags &= ~MU_CFHINT_PROGRAM;
mu_cfg_tree_postprocess (tree, &xhints);
}
}
......@@ -538,8 +537,7 @@ do_include (const char *name, struct mu_cfg_parse_hints *hints,
}
int
mu_cfg_tree_postprocess (mu_cfg_tree_t *tree,
struct mu_cfg_parse_hints *hints)
mu_cfg_tree_postprocess (mu_cfg_tree_t *tree, struct mu_cfg_parse_hints *hints)
{
int rc;
mu_iterator_t itr;
......@@ -558,13 +556,12 @@ mu_cfg_tree_postprocess (mu_cfg_tree_t *tree,
if (node->type == mu_cfg_node_statement)
{
if ((hints->flags & MU_PARSE_CONFIG_GLOBAL) &&
if ((hints->flags & MU_CFHINT_PROGRAM) &&
strcmp (node->tag, "program") == 0)
{
if (node->label->type == MU_CFG_STRING)
{
if ((hints->flags & MU_CFG_PARSE_PROGRAM)
&& strcmp (node->label->v.string, hints->program) == 0)
if (strcmp (node->label->v.string, hints->program) == 0)
{
/* Reset the parent node */
mu_list_foreach (node->nodes, _node_set_parent,
......@@ -1527,10 +1524,11 @@ mu_cfg_parse_config (mu_cfg_tree_t **ptree, struct mu_cfg_parse_hints *hints)
{
int rc = 0;
mu_cfg_tree_t *tree = NULL, *tmp;
struct mu_cfg_parse_hints xhints;
if ((hints->flags & MU_CFG_PARSE_SITE_RCFILE) && hints->site_rcfile)
if ((hints->flags & MU_CFHINT_SITE_FILE) && hints->site_file)
{
rc = mu_cfg_parse_file (&tmp, hints->site_rcfile, hints->flags);
rc = mu_cfg_parse_file (&tmp, hints->site_file, hints->flags);
if (rc == ENOMEM)
{
......@@ -1539,14 +1537,16 @@ mu_cfg_parse_config (mu_cfg_tree_t **ptree, struct mu_cfg_parse_hints *hints)
}
else if (rc == 0)
{
struct mu_cfg_parse_hints xhints = *hints;
xhints.flags |= MU_PARSE_CONFIG_GLOBAL;
mu_cfg_tree_postprocess (tmp, &xhints);
mu_cfg_tree_postprocess (tmp, hints);
mu_cfg_tree_union (&tree, &tmp);
}
}
xhints = *hints;
xhints.flags &= ~MU_CFHINT_PROGRAM;
if ((hints->flags & MU_CFG_PARSE_PROGRAM) && hints->program)
if ((hints->flags & MU_CFHINT_PER_USER_FILE)
&& (hints->flags & MU_CFHINT_PROGRAM))
{
size_t size = 3 + strlen (hints->program) + 1;
char *file_name = malloc (size);
......@@ -1555,7 +1555,7 @@ mu_cfg_parse_config (mu_cfg_tree_t **ptree, struct mu_cfg_parse_hints *hints)
strcpy (file_name, "~/.");
strcat (file_name, hints->program);
rc = mu_cfg_parse_file (&tmp, file_name, hints->flags);
rc = mu_cfg_parse_file (&tmp, file_name, xhints.flags);
if (rc == ENOMEM)
{
mu_error ("%s", mu_strerror (rc));
......@@ -1564,7 +1564,7 @@ mu_cfg_parse_config (mu_cfg_tree_t **ptree, struct mu_cfg_parse_hints *hints)
}
else if (rc == 0)
{
mu_cfg_tree_postprocess (tmp, hints);
mu_cfg_tree_postprocess (tmp, &xhints);
mu_cfg_tree_union (&tree, &tmp);
}
else if (rc == ENOENT)
......@@ -1573,26 +1573,23 @@ mu_cfg_parse_config (mu_cfg_tree_t **ptree, struct mu_cfg_parse_hints *hints)
}
}
if ((hints->flags & MU_CFG_PARSE_CUSTOM_RCFILE) && hints->custom_rcfile)
if ((hints->flags & MU_CFHINT_CUSTOM_FILE) && hints->custom_file)
{
rc = mu_cfg_parse_file (&tmp, hints->custom_rcfile, hints->flags);
rc = mu_cfg_parse_file (&tmp, hints->custom_file, xhints.flags);
if (rc)
{
mu_error (_("errors parsing file %s: %s"), hints->custom_rcfile,
mu_error (_("errors parsing file %s: %s"), hints->custom_file,
mu_strerror (rc));
mu_cfg_destroy_tree (&tree);
return rc;
}
else
{
mu_cfg_tree_postprocess (tmp, hints);
mu_cfg_tree_postprocess (tmp, &xhints);
mu_cfg_tree_union (&tree, &tmp);
}
}
if (hints->flags & MU_CFG_APPEND_TREE)
mu_cfg_tree_union (&tree, &hints->append_tree);
*ptree = tree;
return rc;
}
......
......@@ -18,7 +18,7 @@
source $top_srcdir/testsuite/lib/mailutils.exp
mu_init "--nosum --norc"
mu_init --nosum --norc
#FIXME: this doesn't work with remote testing
set env(MAILRC) $MU_RC_DIR/mail.rc
......
......@@ -58,8 +58,8 @@ mutool_acl (int argc, char **argv)
}
memset (&hints, 0, sizeof (hints));
hints.flags = MU_CFG_PARSE_CUSTOM_RCFILE;
hints.custom_rcfile = input_file_name;
hints.flags = MU_CFHINT_CUSTOM_FILE;
hints.custom_file = input_file_name;
mu_acl_cfg_init ();
if (mu_cfg_parse_config (&tree, &hints))
......
......@@ -43,7 +43,20 @@ int
main (int argc, char **argv)
{
mutool_action_t action;
static struct mu_parseopt pohint = {
.po_flags = MU_PARSEOPT_PACKAGE_NAME
| MU_PARSEOPT_PACKAGE_URL
| MU_PARSEOPT_BUG_ADDRESS
| MU_PARSEOPT_EXTRA_INFO
| MU_PARSEOPT_VERSION_HOOK,
.po_package_name = PACKAGE_NAME,
.po_package_url = PACKAGE_URL,
.po_bug_address = PACKAGE_BUGREPORT,
.po_extra_info = mu_general_help_text,
.po_version_hook = mu_version_hook,
};
struct mu_cfg_parse_hints cfhint = { .flags = 0 };
/* Native Language Support */
MU_APP_INIT_NLS ();
MU_AUTH_REGISTER_ALL_MODULES ();
......@@ -51,7 +64,7 @@ main (int argc, char **argv)
/* Register the desired mailbox formats. */
mu_register_all_mbox_formats ();
mu_cli (argc, argv, &cli, capa, NULL, &argc, &argv);
mu_cli_ext (argc, argv, &cli, &pohint, &cfhint, capa, NULL, &argc, &argv);
if (argc < 1)
{
......
......@@ -17,7 +17,7 @@
#include "mu.h"
char query_docstring[] = N_("query configuration values");
static char query_args_doc[] = N_("path [path...]");
static char query_args_doc[] = N_("PATH [PATH...]");
static char *file_name;
int value_option;
......@@ -59,21 +59,21 @@ mutool_query (int argc, char **argv)
return 1;
}
hints.flags = MU_CFG_PARSE_SITE_RCFILE | MU_PARSE_CONFIG_GLOBAL;
hints.site_rcfile = file_name ? file_name : mu_site_config_file ();
hints.flags = MU_CFHINT_SITE_FILE;
hints.site_file = file_name ? file_name : mu_site_config_file ();
if (progname)
{
hints.flags |= MU_CFG_PARSE_PROGRAM;
hints.flags |= MU_CFHINT_PROGRAM;
hints.program = progname;
}
if (verbose_option)
hints.flags |= MU_CFG_FMT_LOCUS;
hints.flags |= MU_CF_FMT_LOCUS;
if (value_option)
hints.flags |= MU_CFG_FMT_VALUE_ONLY;
hints.flags |= MU_CF_FMT_VALUE_ONLY;
if (path_option)
hints.flags |= MU_CFG_FMT_PARAM_PATH;
hints.flags |= MU_CF_FMT_PARAM_PATH;
if (mu_cfg_parse_config (&tree, &hints))
return 1;
......
......@@ -317,9 +317,10 @@ static char *capa[] = {
};
struct mu_cli_setup cli = {
options,
pop3d_cfg_param,
N_("GNU pop3d -- the POP3 daemon."),
.optv = options,
.cfg = pop3d_cfg_param,
.prog_doc = N_("GNU pop3d -- the POP3 daemon."),
.server = 1
};
int
......
......@@ -17,9 +17,8 @@
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
source $top_srcdir/testsuite/lib/mailutils.exp
mu_init "--rcfile=$objdir/pop3d.rc"
mu_init "--config-file=$objdir/pop3d.rc"
mu_version
if ![mu_check_capability ENABLE_VIRTUAL_DOMAINS] {
clone_output "WARNING: Support for virtual domains not compiled in"
......
......@@ -148,14 +148,25 @@ proc mu_init {args} {
set MU_SPOOL_DIR "$MU_DATA_DIR/spool"
set MU_FOLDER_DIR "$MU_DATA_DIR/folder"
if {[llength $args] == 1 && [lindex $args 0] == "-noflags"} {
set MU_TOOL_FLAGS "--no-site-rcfile --no-user-rcfile"
} else {
set MU_TOOL_FLAGS "--set mailbox.mail-spool=\"'$MU_SPOOL_DIR'\" --no-site-rcfile --no-user-rcfile"
for {set i 0} {$i < [llength $args]} {incr i} {
append MU_TOOL_FLAGS " [lindex $args $i]"
lappend flags "--no-config" "--set mailbox.mail-spool=\"'$MU_SPOOL_DIR'\""
set i 0
for {} {$i < [llength $args]} {incr i} {
switch -- [lindex $args $i] {
-noflags {
unset flags
}
-- {
incr i
break
}
default {
break
}
}
}
lappend flags {*}[lrange $args $i end]
set MU_TOOL_FLAGS [join $flags { }]
}
}
......