Commit 72a07718 72a077186e92a450090bf435f6e90a23f4375b43 by Sergey Poznyakoff

* include/mailutils/libargp.h (mu_argp_build): Change proto.

* libargp/compat.c (mu_argp_parse): Update call to mu_argp_build.
* libargp/mu_argp.c (mu_argp_build): Optionally return expanded
capability list in the third argument.
* libargp/muinit.c (mu_app_init): Pass expanded capability list to
mu_libcfg_init.
1 parent 9a972686
2007-11-19 Sergey Poznyakoff <gray@gnu.org.ua>
* include/mailutils/libargp.h (mu_argp_build): Change proto.
* libargp/compat.c (mu_argp_parse): Update call to mu_argp_build.
* libargp/mu_argp.c (mu_argp_build): Optionally return expanded
capability list in the third argument.
* libargp/muinit.c (mu_app_init): Pass expanded capability list to
mu_libcfg_init.
* include/mailutils/cfg.h (mu_cfg_parser_verbose): New variable.
* include/mailutils/libargp.h (OPT_RCFILE_VERBOSE): New value.
* libargp/Makefile.am (AM_CFLAGS): Rename to AM_CPPFLAGS, define
......
......@@ -106,7 +106,7 @@ extern struct mu_cmdline_capa mu_auth_cmdline;
extern void mu_libargp_init (void);
extern struct argp *mu_argp_build (const struct argp *argp);
extern struct argp *mu_argp_build (const struct argp *argp, char ***pcapa);
extern void mu_argp_done (struct argp *argp);
extern int mu_register_argp_capa (const char *name, struct argp_child *child);
......
......@@ -326,7 +326,7 @@ mu_argp_parse (const struct argp *myargp,
if (!myargp)
myargp = &argpnull;
argp = mu_argp_build (myargp);
argp = mu_argp_build (myargp, NULL);
rc = argp_parse (argp, *pargc, *pargv, flags, arg_index, input);
mu_argp_done (argp);
if (rc)
......
......@@ -196,7 +196,7 @@ argp_reg_action (void *item, void *data)
}
struct argp *
mu_argp_build (const struct argp *init_argp)
mu_argp_build (const struct argp *init_argp, char ***pcapa)
{
struct cap_buf cb;
struct argp *argp;
......@@ -206,7 +206,10 @@ mu_argp_build (const struct argp *init_argp)
cap_buf_add (&cb, NULL);
mu_libargp_init ();
argp = mu_build_argp (init_argp, cb.capa);
cap_buf_free (&cb);
if (pcapa)
*pcapa = cb.capa;
else
cap_buf_free (&cb);
return argp;
}
......
......@@ -38,22 +38,24 @@ mu_app_init (struct argp *myargp, const char **capa,
int rc, i;
struct argp *argp;
const struct argp argpnull = { 0 };
char **excapa;
mu_set_program_name (argv[0]);
mu_libargp_init ();
for (i = 0; capa[i]; i++)
mu_gocs_register_std (capa[i]); /*FIXME*/
if (!myargp)
myargp = &argpnull;
argp = mu_argp_build (myargp);
argp = mu_argp_build (myargp, &excapa);
rc = argp_parse (argp, argc, argv, flags, pindex, data);
mu_argp_done (argp);
if (rc)
return rc;
mu_libcfg_init (capa);
mu_libcfg_init (excapa);
free (excapa);
mu_parse_config_files (cfg_param);
mu_gocs_flush ();
return 0;
......