* 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.
Showing
5 changed files
with
17 additions
and
5 deletions
1 | 2007-11-19 Sergey Poznyakoff <gray@gnu.org.ua> | 1 | 2007-11-19 Sergey Poznyakoff <gray@gnu.org.ua> |
2 | 2 | ||
3 | * include/mailutils/libargp.h (mu_argp_build): Change proto. | ||
4 | * libargp/compat.c (mu_argp_parse): Update call to mu_argp_build. | ||
5 | * libargp/mu_argp.c (mu_argp_build): Optionally return expanded | ||
6 | capability list in the third argument. | ||
7 | * libargp/muinit.c (mu_app_init): Pass expanded capability list to | ||
8 | mu_libcfg_init. | ||
9 | |||
3 | * include/mailutils/cfg.h (mu_cfg_parser_verbose): New variable. | 10 | * include/mailutils/cfg.h (mu_cfg_parser_verbose): New variable. |
4 | * include/mailutils/libargp.h (OPT_RCFILE_VERBOSE): New value. | 11 | * include/mailutils/libargp.h (OPT_RCFILE_VERBOSE): New value. |
5 | * libargp/Makefile.am (AM_CFLAGS): Rename to AM_CPPFLAGS, define | 12 | * libargp/Makefile.am (AM_CFLAGS): Rename to AM_CPPFLAGS, define | ... | ... |
... | @@ -106,7 +106,7 @@ extern struct mu_cmdline_capa mu_auth_cmdline; | ... | @@ -106,7 +106,7 @@ extern struct mu_cmdline_capa mu_auth_cmdline; |
106 | 106 | ||
107 | extern void mu_libargp_init (void); | 107 | extern void mu_libargp_init (void); |
108 | 108 | ||
109 | extern struct argp *mu_argp_build (const struct argp *argp); | 109 | extern struct argp *mu_argp_build (const struct argp *argp, char ***pcapa); |
110 | extern void mu_argp_done (struct argp *argp); | 110 | extern void mu_argp_done (struct argp *argp); |
111 | 111 | ||
112 | extern int mu_register_argp_capa (const char *name, struct argp_child *child); | 112 | extern int mu_register_argp_capa (const char *name, struct argp_child *child); | ... | ... |
... | @@ -326,7 +326,7 @@ mu_argp_parse (const struct argp *myargp, | ... | @@ -326,7 +326,7 @@ mu_argp_parse (const struct argp *myargp, |
326 | 326 | ||
327 | if (!myargp) | 327 | if (!myargp) |
328 | myargp = &argpnull; | 328 | myargp = &argpnull; |
329 | argp = mu_argp_build (myargp); | 329 | argp = mu_argp_build (myargp, NULL); |
330 | rc = argp_parse (argp, *pargc, *pargv, flags, arg_index, input); | 330 | rc = argp_parse (argp, *pargc, *pargv, flags, arg_index, input); |
331 | mu_argp_done (argp); | 331 | mu_argp_done (argp); |
332 | if (rc) | 332 | if (rc) | ... | ... |
... | @@ -196,7 +196,7 @@ argp_reg_action (void *item, void *data) | ... | @@ -196,7 +196,7 @@ argp_reg_action (void *item, void *data) |
196 | } | 196 | } |
197 | 197 | ||
198 | struct argp * | 198 | struct argp * |
199 | mu_argp_build (const struct argp *init_argp) | 199 | mu_argp_build (const struct argp *init_argp, char ***pcapa) |
200 | { | 200 | { |
201 | struct cap_buf cb; | 201 | struct cap_buf cb; |
202 | struct argp *argp; | 202 | struct argp *argp; |
... | @@ -206,6 +206,9 @@ mu_argp_build (const struct argp *init_argp) | ... | @@ -206,6 +206,9 @@ mu_argp_build (const struct argp *init_argp) |
206 | cap_buf_add (&cb, NULL); | 206 | cap_buf_add (&cb, NULL); |
207 | mu_libargp_init (); | 207 | mu_libargp_init (); |
208 | argp = mu_build_argp (init_argp, cb.capa); | 208 | argp = mu_build_argp (init_argp, cb.capa); |
209 | if (pcapa) | ||
210 | *pcapa = cb.capa; | ||
211 | else | ||
209 | cap_buf_free (&cb); | 212 | cap_buf_free (&cb); |
210 | return argp; | 213 | return argp; |
211 | } | 214 | } | ... | ... |
... | @@ -38,6 +38,7 @@ mu_app_init (struct argp *myargp, const char **capa, | ... | @@ -38,6 +38,7 @@ mu_app_init (struct argp *myargp, const char **capa, |
38 | int rc, i; | 38 | int rc, i; |
39 | struct argp *argp; | 39 | struct argp *argp; |
40 | const struct argp argpnull = { 0 }; | 40 | const struct argp argpnull = { 0 }; |
41 | char **excapa; | ||
41 | 42 | ||
42 | mu_set_program_name (argv[0]); | 43 | mu_set_program_name (argv[0]); |
43 | mu_libargp_init (); | 44 | mu_libargp_init (); |
... | @@ -45,13 +46,14 @@ mu_app_init (struct argp *myargp, const char **capa, | ... | @@ -45,13 +46,14 @@ mu_app_init (struct argp *myargp, const char **capa, |
45 | mu_gocs_register_std (capa[i]); /*FIXME*/ | 46 | mu_gocs_register_std (capa[i]); /*FIXME*/ |
46 | if (!myargp) | 47 | if (!myargp) |
47 | myargp = &argpnull; | 48 | myargp = &argpnull; |
48 | argp = mu_argp_build (myargp); | 49 | argp = mu_argp_build (myargp, &excapa); |
49 | rc = argp_parse (argp, argc, argv, flags, pindex, data); | 50 | rc = argp_parse (argp, argc, argv, flags, pindex, data); |
50 | mu_argp_done (argp); | 51 | mu_argp_done (argp); |
51 | if (rc) | 52 | if (rc) |
52 | return rc; | 53 | return rc; |
53 | 54 | ||
54 | mu_libcfg_init (capa); | 55 | mu_libcfg_init (excapa); |
56 | free (excapa); | ||
55 | mu_parse_config_files (cfg_param); | 57 | mu_parse_config_files (cfg_param); |
56 | 58 | ||
57 | mu_gocs_flush (); | 59 | mu_gocs_flush (); | ... | ... |
-
Please register or sign in to post a comment