* imap4d/imap4d.h: Include xalloc.h
* frm/common.c, imap4d/imap4d.c: Shut compiler warnings. * include/mailutils/cfg.h (mu_cfg_format_tree): Rename to mu_cfg_format_parse_tree (mu_cfg_format_container,mu_format_config_tree): New functions. (mu_parse_config_tree): New prototype. (mu_cfg_tree_create_node): Change signature (const char* instead of char*). * include/mailutils/gocs.h (mu_gocs_register): First arg is const. * include/mailutils/libargp.h (mu_argp_node_list_new): Mark invariable arguments as const. * include/mailutils/libcfg.h (mu_libcfg_init): Remove const from the arg. * include/mailutils/mutil.h (mu_spawnvp): Remove const from the 2nd arg. * libargp/cmdline.c (mu_argp_node_list_new): Mark invariable arguments as const. * lib/mailcap.h: New file. * lib/Makefile.am (libmuaux_la_SOURCES): Add mailcap.h * libargp/cmdline.h (mu_help_config_mode): New extern. * libargp/common.c: New option --config-help displays a configuration file summary. * libargp/muinit.c (mu_app_init): Handle --config-help. * libcfg/init.c (mu_libcfg_init): Remove const from the arg. * maidag/maidag.h (mda): New prototype. * mail/decode.c: Include mailcap.h * mail/mail.h: Define _GNU_SOURCE before including stdio.h * mail/send.c: Fix includes. * mail.remote/mail.remote.c: Include mu_umaxtostr.h * mailbox/cfg_format.c (mu_cfg_data_type_string) (mu_cfg_format_container): New function. * mailbox/cfg_lexer.c (mu_build_container): New function. (mu_parse_config_tree): Use mu_build_container. (mu_format_config_tree): New function. * mailbox/cfg_parser.y (mu_cfg_tree_create_node): Change proto. * mailbox/gocs.c (struct mu_gocs_entry): Name is const. (mu_gocs_register): 1st arg (capa) is const. * mailbox/mutil.c (mu_spawnvp): Remove const from the 2nd arg. * mh/mh_whatnow.c (invoke): Shut compiler warnings. * mimeview/mimetypes.l (mimetypes_open): Shut compiler warnings. * mimeview/mimeview.c: Include mailcap.h (display_file): Shut compiler warnings. * readmsg/readmsg.c: Include mu_umaxtostr.h * sieve/sieve.c (parser): Remove unused variable.
Showing
31 changed files
with
353 additions
and
106 deletions
1 | 2007-12-04 Sergey Poznyakoff <gray@gnu.org.ua> | ||
2 | |||
3 | * imap4d/imap4d.h: Include xalloc.h | ||
4 | * frm/common.c, imap4d/imap4d.c: Shut compiler warnings. | ||
5 | * include/mailutils/cfg.h (mu_cfg_format_tree): Rename to | ||
6 | mu_cfg_format_parse_tree | ||
7 | (mu_cfg_format_container,mu_format_config_tree): New functions. | ||
8 | (mu_parse_config_tree): New prototype. | ||
9 | (mu_cfg_tree_create_node): Change signature (const char* instead | ||
10 | of char*). | ||
11 | * include/mailutils/gocs.h (mu_gocs_register): First arg is const. | ||
12 | * include/mailutils/libargp.h (mu_argp_node_list_new): Mark | ||
13 | invariable arguments as const. | ||
14 | * include/mailutils/libcfg.h (mu_libcfg_init): Remove const from | ||
15 | the arg. | ||
16 | * include/mailutils/mutil.h (mu_spawnvp): Remove const from the | ||
17 | 2nd arg. | ||
18 | * libargp/cmdline.c (mu_argp_node_list_new): Mark invariable | ||
19 | arguments as const. | ||
20 | |||
21 | * lib/mailcap.h: New file. | ||
22 | * lib/Makefile.am (libmuaux_la_SOURCES): Add mailcap.h | ||
23 | * libargp/cmdline.h (mu_help_config_mode): New extern. | ||
24 | * libargp/common.c: New option --config-help displays a | ||
25 | configuration file summary. | ||
26 | * libargp/muinit.c (mu_app_init): Handle --config-help. | ||
27 | * libcfg/init.c (mu_libcfg_init): Remove const from the arg. | ||
28 | * maidag/maidag.h (mda): New prototype. | ||
29 | * mail/decode.c: Include mailcap.h | ||
30 | * mail/mail.h: Define _GNU_SOURCE before including stdio.h | ||
31 | * mail/send.c: Fix includes. | ||
32 | * mail.remote/mail.remote.c: Include mu_umaxtostr.h | ||
33 | |||
34 | * mailbox/cfg_format.c (mu_cfg_data_type_string) | ||
35 | (mu_cfg_format_container): New function. | ||
36 | * mailbox/cfg_lexer.c (mu_build_container): New function. | ||
37 | (mu_parse_config_tree): Use mu_build_container. | ||
38 | (mu_format_config_tree): New function. | ||
39 | * mailbox/cfg_parser.y (mu_cfg_tree_create_node): Change proto. | ||
40 | * mailbox/gocs.c (struct mu_gocs_entry): Name is const. | ||
41 | (mu_gocs_register): 1st arg (capa) is const. | ||
42 | * mailbox/mutil.c (mu_spawnvp): Remove const from the 2nd arg. | ||
43 | * mh/mh_whatnow.c (invoke): Shut compiler warnings. | ||
44 | * mimeview/mimetypes.l (mimetypes_open): Shut compiler warnings. | ||
45 | * mimeview/mimeview.c: Include mailcap.h | ||
46 | (display_file): Shut compiler warnings. | ||
47 | * readmsg/readmsg.c: Include mu_umaxtostr.h | ||
48 | * sieve/sieve.c (parser): Remove unused variable. | ||
49 | |||
1 | 2007-12-03 Sergey Poznyakoff <gray@gnu.org.ua> | 50 | 2007-12-03 Sergey Poznyakoff <gray@gnu.org.ua> |
2 | 51 | ||
3 | * auth/virtual.c (site_virtual_pwddir): Replace with global | 52 | * auth/virtual.c (site_virtual_pwddir): Replace with global | ... | ... |
... | @@ -122,7 +122,7 @@ puts_bidi (char *string) | ... | @@ -122,7 +122,7 @@ puts_bidi (char *string) |
122 | { | 122 | { |
123 | if (fb_charset_num == -1) | 123 | if (fb_charset_num == -1) |
124 | { | 124 | { |
125 | fb_charset_num = fribidi_parse_charset (get_charset ()); | 125 | fb_charset_num = fribidi_parse_charset ((char*) get_charset ()); |
126 | if (fb_charset_num && frm_debug) | 126 | if (fb_charset_num && frm_debug) |
127 | mu_error (_("fribidi failed to recognize charset `%s'"), | 127 | mu_error (_("fribidi failed to recognize charset `%s'"), |
128 | get_charset ()); | 128 | get_charset ()); | ... | ... |
... | @@ -203,7 +203,7 @@ parse_preauth_scheme (mu_debug_t debug, const char *scheme, mu_url_t url) | ... | @@ -203,7 +203,7 @@ parse_preauth_scheme (mu_debug_t debug, const char *scheme, mu_url_t url) |
203 | long n; | 203 | long n; |
204 | if (url && mu_url_get_port (url, &n) == 0) | 204 | if (url && mu_url_get_port (url, &n) == 0) |
205 | ident_port = (short) n; | 205 | ident_port = (short) n; |
206 | else if (sp = getservbyname ("auth", "tcp")) | 206 | else if ((sp = getservbyname ("auth", "tcp"))) |
207 | ident_port = ntohs (sp->s_port); | 207 | ident_port = ntohs (sp->s_port); |
208 | else | 208 | else |
209 | ident_port = 113; | 209 | ident_port = 113; | ... | ... |
... | @@ -70,6 +70,8 @@ | ... | @@ -70,6 +70,8 @@ |
70 | # include <paths.h> | 70 | # include <paths.h> |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | #include "xalloc.h" | ||
74 | |||
73 | #include <mailutils/address.h> | 75 | #include <mailutils/address.h> |
74 | #include <mailutils/attribute.h> | 76 | #include <mailutils/attribute.h> |
75 | #include <mailutils/body.h> | 77 | #include <mailutils/body.h> |
... | @@ -210,6 +212,7 @@ extern int imap4d_login (struct imap4d_command *, char *); | ... | @@ -210,6 +212,7 @@ extern int imap4d_login (struct imap4d_command *, char *); |
210 | extern int imap4d_logout (struct imap4d_command *, char *); | 212 | extern int imap4d_logout (struct imap4d_command *, char *); |
211 | extern int imap4d_noop (struct imap4d_command *, char *); | 213 | extern int imap4d_noop (struct imap4d_command *, char *); |
212 | extern int imap4d_rename (struct imap4d_command *, char *); | 214 | extern int imap4d_rename (struct imap4d_command *, char *); |
215 | extern int imap4d_preauth_setup (int fd); | ||
213 | extern int imap4d_search (struct imap4d_command *, char *); | 216 | extern int imap4d_search (struct imap4d_command *, char *); |
214 | extern int imap4d_search0 (char *arg, int isuid, char *replybuf, size_t replysize); | 217 | extern int imap4d_search0 (char *arg, int isuid, char *replybuf, size_t replysize); |
215 | extern int imap4d_select (struct imap4d_command *, char *); | 218 | extern int imap4d_select (struct imap4d_command *, char *); | ... | ... |
... | @@ -209,7 +209,12 @@ int mu_cfg_parse_boolean (const char *str, int *res); | ... | @@ -209,7 +209,12 @@ int mu_cfg_parse_boolean (const char *str, int *res); |
209 | 209 | ||
210 | extern int mu_cfg_parser_verbose; | 210 | extern int mu_cfg_parser_verbose; |
211 | 211 | ||
212 | void mu_cfg_format_tree (mu_stream_t stream, struct mu_cfg_tree *tree); | 212 | void mu_cfg_format_parse_tree (mu_stream_t stream, struct mu_cfg_tree *tree); |
213 | void mu_cfg_format_container (mu_stream_t stream, struct mu_cfg_cont *cont); | ||
214 | void mu_format_config_tree (mu_stream_t stream, const char *progname, | ||
215 | struct mu_cfg_param *progparam, int flags); | ||
216 | int mu_parse_config_tree (mu_cfg_tree_t *parse_tree, const char *progname, | ||
217 | struct mu_cfg_param *progparam, int flags); | ||
213 | 218 | ||
214 | int mu_cfg_tree_create (struct mu_cfg_tree **ptree); | 219 | int mu_cfg_tree_create (struct mu_cfg_tree **ptree); |
215 | void mu_cfg_tree_set_debug (struct mu_cfg_tree *tree, mu_debug_t debug); | 220 | void mu_cfg_tree_set_debug (struct mu_cfg_tree *tree, mu_debug_t debug); |
... | @@ -217,10 +222,11 @@ void mu_cfg_tree_set_alloc (struct mu_cfg_tree *tree, | ... | @@ -217,10 +222,11 @@ void mu_cfg_tree_set_alloc (struct mu_cfg_tree *tree, |
217 | mu_cfg_alloc_t alloc, mu_cfg_free_t free); | 222 | mu_cfg_alloc_t alloc, mu_cfg_free_t free); |
218 | void *mu_cfg_tree_alloc (struct mu_cfg_tree *tree, size_t size); | 223 | void *mu_cfg_tree_alloc (struct mu_cfg_tree *tree, size_t size); |
219 | void mu_cfg_tree_free (struct mu_cfg_tree *tree, void *mem); | 224 | void mu_cfg_tree_free (struct mu_cfg_tree *tree, void *mem); |
220 | mu_cfg_node_t *mu_cfg_tree_create_node | 225 | mu_cfg_node_t *mu_cfg_tree_create_node (struct mu_cfg_tree *tree, |
221 | (struct mu_cfg_tree *tree, enum mu_cfg_node_type type, | 226 | enum mu_cfg_node_type type, |
222 | mu_cfg_locus_t *loc, char *tag, char *label, | 227 | const mu_cfg_locus_t *loc, |
223 | mu_cfg_node_t *node); | 228 | const char *tag, const char *label, |
229 | mu_cfg_node_t *node); | ||
224 | void mu_cfg_tree_add_node (mu_cfg_tree_t *tree, mu_cfg_node_t *node); | 230 | void mu_cfg_tree_add_node (mu_cfg_tree_t *tree, mu_cfg_node_t *node); |
225 | 231 | ||
226 | #ifdef __cplusplus | 232 | #ifdef __cplusplus | ... | ... |
... | @@ -95,7 +95,7 @@ extern int log_facility; /* FIXME: 1. Belongs elsewhere; | ... | @@ -95,7 +95,7 @@ extern int log_facility; /* FIXME: 1. Belongs elsewhere; |
95 | 95 | ||
96 | typedef int (*gocs_init_fp) (void *data); | 96 | typedef int (*gocs_init_fp) (void *data); |
97 | 97 | ||
98 | void mu_gocs_register (char *capa, gocs_init_fp init); | 98 | void mu_gocs_register (const char *capa, gocs_init_fp init); |
99 | void mu_gocs_register_std (const char *name); | 99 | void mu_gocs_register_std (const char *name); |
100 | void mu_gocs_store (char *capa, void *data); | 100 | void mu_gocs_store (char *capa, void *data); |
101 | void mu_gocs_flush (void); | 101 | void mu_gocs_flush (void); | ... | ... |
... | @@ -89,7 +89,7 @@ struct mu_argp_node_list | ... | @@ -89,7 +89,7 @@ struct mu_argp_node_list |
89 | void mu_argp_node_list_init (struct mu_argp_node_list *); | 89 | void mu_argp_node_list_init (struct mu_argp_node_list *); |
90 | void mu_argp_node_list_add (struct mu_argp_node_list *, mu_cfg_node_t *); | 90 | void mu_argp_node_list_add (struct mu_argp_node_list *, mu_cfg_node_t *); |
91 | void mu_argp_node_list_new (struct mu_argp_node_list *, | 91 | void mu_argp_node_list_new (struct mu_argp_node_list *, |
92 | char *, char *); | 92 | const char *, const char *); |
93 | void mu_argp_node_list_finish (struct mu_argp_node_list *, char *, char *); | 93 | void mu_argp_node_list_finish (struct mu_argp_node_list *, char *, char *); |
94 | 94 | ||
95 | #ifdef __cplusplus | 95 | #ifdef __cplusplus | ... | ... |
... | @@ -48,7 +48,7 @@ extern int mu_register_cfg_capa (const char *name, | ... | @@ -48,7 +48,7 @@ extern int mu_register_cfg_capa (const char *name, |
48 | struct mu_cfg_param *cfgparam, | 48 | struct mu_cfg_param *cfgparam, |
49 | mu_cfg_section_fp *parser); | 49 | mu_cfg_section_fp *parser); |
50 | 50 | ||
51 | extern void mu_libcfg_init (const char **cnames); | 51 | extern void mu_libcfg_init (char **cnames); |
52 | extern int mu_parse_config_files (struct mu_cfg_param *param); | 52 | extern int mu_parse_config_files (struct mu_cfg_param *param); |
53 | 53 | ||
54 | #define __mu_common_cat2__(a,b) a ## b | 54 | #define __mu_common_cat2__(a,b) a ## b | ... | ... |
... | @@ -104,7 +104,7 @@ extern char *mu_tempname (const char *tmpdir); | ... | @@ -104,7 +104,7 @@ extern char *mu_tempname (const char *tmpdir); |
104 | extern char * mu_get_full_path (const char *file); | 104 | extern char * mu_get_full_path (const char *file); |
105 | extern char * mu_getcwd (void); | 105 | extern char * mu_getcwd (void); |
106 | 106 | ||
107 | extern int mu_spawnvp(const char* prog, char * const av[], int* stat); | 107 | extern int mu_spawnvp(const char *prog, char *av[], int *stat); |
108 | 108 | ||
109 | typedef void *(*mu_retrieve_fp) (void *); | 109 | typedef void *(*mu_retrieve_fp) (void *); |
110 | extern void mu_register_retriever (mu_list_t *pflist, mu_retrieve_fp fun); | 110 | extern void mu_register_retriever (mu_list_t *pflist, mu_retrieve_fp fun); | ... | ... |
... | @@ -25,6 +25,7 @@ INCLUDES = @MU_COMMON_INCLUDES@ | ... | @@ -25,6 +25,7 @@ INCLUDES = @MU_COMMON_INCLUDES@ |
25 | libmuaux_la_SOURCES += \ | 25 | libmuaux_la_SOURCES += \ |
26 | daemon.c\ | 26 | daemon.c\ |
27 | mailcap.c\ | 27 | mailcap.c\ |
28 | mailcap.h\ | ||
28 | mu_dbm.c | 29 | mu_dbm.c |
29 | 30 | ||
30 | noinst_HEADERS +=\ | 31 | noinst_HEADERS +=\ | ... | ... |
lib/mailcap.h
0 → 100644
... | @@ -83,7 +83,7 @@ mu_argp_node_list_add (struct mu_argp_node_list *lst, mu_cfg_node_t *node) | ... | @@ -83,7 +83,7 @@ mu_argp_node_list_add (struct mu_argp_node_list *lst, mu_cfg_node_t *node) |
83 | 83 | ||
84 | void | 84 | void |
85 | mu_argp_node_list_new (struct mu_argp_node_list *lst, | 85 | mu_argp_node_list_new (struct mu_argp_node_list *lst, |
86 | char *tag, char *label) | 86 | const char *tag, const char *label) |
87 | { | 87 | { |
88 | mu_cfg_node_t *node; | 88 | mu_cfg_node_t *node; |
89 | mu_cfg_locus_t loc = { "command line", 0 }; | 89 | mu_cfg_locus_t loc = { "command line", 0 }; | ... | ... |
... | @@ -44,14 +44,17 @@ enum { | ... | @@ -44,14 +44,17 @@ enum { |
44 | OPT_LICENSE, | 44 | OPT_LICENSE, |
45 | OPT_MAILBOX_TYPE, | 45 | OPT_MAILBOX_TYPE, |
46 | OPT_DEBUG_LEVEL, | 46 | OPT_DEBUG_LEVEL, |
47 | OPT_LINE_INFO | 47 | OPT_LINE_INFO, |
48 | OPT_HELP_CONFIG | ||
48 | }; | 49 | }; |
49 | 50 | ||
50 | static struct argp_option mu_common_argp_options[] = | 51 | static struct argp_option mu_common_argp_options[] = |
51 | { | 52 | { |
52 | { NULL, 0, NULL, 0, N_("Common options"), 0}, | 53 | { NULL, 0, NULL, 0, N_("Common options"), 0}, |
53 | { "show-config-options", OPT_SHOW_OPTIONS, NULL, OPTION_HIDDEN, | 54 | { "show-config-options", OPT_SHOW_OPTIONS, NULL, 0, |
54 | N_("Show compilation options"), 0 }, | 55 | N_("Show compilation options"), 0 }, |
56 | { "config-help", OPT_HELP_CONFIG, NULL, 0, | ||
57 | N_("Show configuration file summary"), 0 }, | ||
55 | { "no-user-rcfile", OPT_NO_USER_RCFILE, NULL, 0, | 58 | { "no-user-rcfile", OPT_NO_USER_RCFILE, NULL, 0, |
56 | N_("Do not load user configuration file"), 0 }, | 59 | N_("Do not load user configuration file"), 0 }, |
57 | { "no-site-rcfile", OPT_NO_SITE_RCFILE, NULL, 0, | 60 | { "no-site-rcfile", OPT_NO_SITE_RCFILE, NULL, 0, |
... | @@ -87,7 +90,11 @@ mu_common_argp_parser (int key, char *arg, struct argp_state *state) | ... | @@ -87,7 +90,11 @@ mu_common_argp_parser (int key, char *arg, struct argp_state *state) |
87 | case OPT_RCFILE_VERBOSE: | 90 | case OPT_RCFILE_VERBOSE: |
88 | mu_cfg_parser_verbose++; | 91 | mu_cfg_parser_verbose++; |
89 | break; | 92 | break; |
90 | 93 | ||
94 | case OPT_HELP_CONFIG: | ||
95 | mu_help_config_mode = 1; | ||
96 | break; | ||
97 | |||
91 | default: | 98 | default: |
92 | return ARGP_ERR_UNKNOWN; | 99 | return ARGP_ERR_UNKNOWN; |
93 | } | 100 | } | ... | ... |
... | @@ -21,6 +21,8 @@ | ... | @@ -21,6 +21,8 @@ |
21 | #endif | 21 | #endif |
22 | #include "cmdline.h" | 22 | #include "cmdline.h" |
23 | #include <mailutils/stream.h> | 23 | #include <mailutils/stream.h> |
24 | #include "xalloc.h" | ||
25 | #include <string.h> | ||
24 | 26 | ||
25 | struct mu_cfg_tree *mu_argp_tree; | 27 | struct mu_cfg_tree *mu_argp_tree; |
26 | 28 | ||
... | @@ -31,7 +33,22 @@ mu_argp_init (const char *vers, const char *bugaddr) | ... | @@ -31,7 +33,22 @@ mu_argp_init (const char *vers, const char *bugaddr) |
31 | argp_program_bug_address = bugaddr ? bugaddr : "<" PACKAGE_BUGREPORT ">"; | 33 | argp_program_bug_address = bugaddr ? bugaddr : "<" PACKAGE_BUGREPORT ">"; |
32 | } | 34 | } |
33 | 35 | ||
34 | extern struct mu_cfg_cont *mu_cfg_root_container; /* FIXME */ | 36 | static char * |
37 | get_canonical_name () | ||
38 | { | ||
39 | char *name; | ||
40 | size_t len; | ||
41 | char *p = strchr (argp_program_version, ' '); | ||
42 | if (!p) | ||
43 | return strdup (mu_program_name); | ||
44 | len = p - argp_program_version; | ||
45 | name = xmalloc (len + 1); | ||
46 | memcpy (name, argp_program_version, len); | ||
47 | name[len] = 0; | ||
48 | return name; | ||
49 | } | ||
50 | |||
51 | int mu_help_config_mode; | ||
35 | 52 | ||
36 | int | 53 | int |
37 | mu_app_init (struct argp *myargp, const char **capa, | 54 | mu_app_init (struct argp *myargp, const char **capa, |
... | @@ -40,9 +57,9 @@ mu_app_init (struct argp *myargp, const char **capa, | ... | @@ -40,9 +57,9 @@ mu_app_init (struct argp *myargp, const char **capa, |
40 | { | 57 | { |
41 | int rc, i; | 58 | int rc, i; |
42 | struct argp *argp; | 59 | struct argp *argp; |
43 | const struct argp argpnull = { 0 }; | 60 | struct argp argpnull = { 0 }; |
44 | char **excapa; | 61 | char **excapa; |
45 | int flags = 0; | 62 | int cfgflags = 0; |
46 | 63 | ||
47 | mu_set_program_name (argv[0]); | 64 | mu_set_program_name (argv[0]); |
48 | mu_libargp_init (); | 65 | mu_libargp_init (); |
... | @@ -62,11 +79,36 @@ mu_app_init (struct argp *myargp, const char **capa, | ... | @@ -62,11 +79,36 @@ mu_app_init (struct argp *myargp, const char **capa, |
62 | free (excapa); | 79 | free (excapa); |
63 | mu_parse_config_files (cfg_param); | 80 | mu_parse_config_files (cfg_param); |
64 | 81 | ||
82 | if (mu_help_config_mode) | ||
83 | { | ||
84 | char *canonical_name = get_canonical_name (); | ||
85 | mu_stream_t stream; | ||
86 | mu_stdio_stream_create (&stream, stdout, | ||
87 | MU_STREAM_NO_CHECK|MU_STREAM_NO_CLOSE); | ||
88 | mu_stream_open (stream); | ||
89 | mu_stream_sequential_printf (stream, | ||
90 | "# Configuration file structure for %s utility.\n", | ||
91 | mu_program_name); | ||
92 | mu_stream_sequential_printf (stream, | ||
93 | "# For use in global configuration file (%s), enclose it\n" | ||
94 | "# in `program %s { ... };'\n", | ||
95 | MU_CONFIG_FILE, | ||
96 | mu_program_name); | ||
97 | mu_stream_sequential_printf (stream, | ||
98 | "# For more information, use `info %s'.\n", | ||
99 | canonical_name); | ||
100 | |||
101 | mu_format_config_tree (stream, mu_program_name, cfg_param, 0); | ||
102 | mu_stream_destroy (&stream, NULL); | ||
103 | exit (0); | ||
104 | } | ||
105 | |||
65 | if (mu_cfg_parser_verbose) | 106 | if (mu_cfg_parser_verbose) |
66 | flags |= MU_PARSE_CONFIG_VERBOSE; | 107 | cfgflags |= MU_PARSE_CONFIG_VERBOSE; |
67 | if (mu_cfg_parser_verbose > 1) | 108 | if (mu_cfg_parser_verbose > 1) |
68 | flags |= MU_PARSE_CONFIG_DUMP; | 109 | cfgflags |= MU_PARSE_CONFIG_DUMP; |
69 | rc = mu_parse_config_tree (mu_argp_tree, mu_program_name, cfg_param, flags); | 110 | rc = mu_parse_config_tree (mu_argp_tree, mu_program_name, cfg_param, |
111 | cfgflags); | ||
70 | 112 | ||
71 | mu_gocs_flush (); | 113 | mu_gocs_flush (); |
72 | mu_cfg_destroy_tree (&mu_argp_tree); | 114 | mu_cfg_destroy_tree (&mu_argp_tree); | ... | ... |
... | @@ -66,7 +66,7 @@ reserved_name (const char *name) | ... | @@ -66,7 +66,7 @@ reserved_name (const char *name) |
66 | } | 66 | } |
67 | 67 | ||
68 | void | 68 | void |
69 | mu_libcfg_init (const char **cnames) | 69 | mu_libcfg_init (char **cnames) |
70 | { | 70 | { |
71 | int i; | 71 | int i; |
72 | for (i = 0; cnames[i]; i++) | 72 | for (i = 0; cnames[i]; i++) | ... | ... |
... | @@ -132,6 +132,7 @@ void mailer_err (char *fmt, ...); | ... | @@ -132,6 +132,7 @@ void mailer_err (char *fmt, ...); |
132 | void notify_biff (mu_mailbox_t mbox, char *name, size_t size); | 132 | void notify_biff (mu_mailbox_t mbox, char *name, size_t size); |
133 | void guess_retval (int ec); | 133 | void guess_retval (int ec); |
134 | 134 | ||
135 | int mda (mu_mailbox_t mbx, char *username); | ||
135 | int deliver (mu_mailbox_t imbx, char *name, char **errp); | 136 | int deliver (mu_mailbox_t imbx, char *name, char **errp); |
136 | int sieve_test (struct mu_auth_data *auth, mu_mailbox_t mbx); | 137 | int sieve_test (struct mu_auth_data *auth, mu_mailbox_t mbx); |
137 | int check_quota (struct mu_auth_data *auth, mu_off_t size, mu_off_t *rest); | 138 | int check_quota (struct mu_auth_data *auth, mu_off_t size, mu_off_t *rest); | ... | ... |
... | @@ -45,6 +45,8 @@ | ... | @@ -45,6 +45,8 @@ |
45 | #include <mailutils/mu_auth.h> | 45 | #include <mailutils/mu_auth.h> |
46 | #include "mailutils/libargp.h" | 46 | #include "mailutils/libargp.h" |
47 | 47 | ||
48 | #include "mu_umaxtostr.h" | ||
49 | |||
48 | const char *program_version = "mail.remote (" PACKAGE_STRING ")"; | 50 | const char *program_version = "mail.remote (" PACKAGE_STRING ")"; |
49 | static char doc[] = | 51 | static char doc[] = |
50 | N_("GNU mail.remote -- pseudo-sendmail interface for mail delivery") | 52 | N_("GNU mail.remote -- pseudo-sendmail interface for mail delivery") | ... | ... |
... | @@ -33,6 +33,9 @@ | ... | @@ -33,6 +33,9 @@ |
33 | #endif | 33 | #endif |
34 | #include <errno.h> | 34 | #include <errno.h> |
35 | #include <limits.h> | 35 | #include <limits.h> |
36 | #ifndef _GNU_SOURCE | ||
37 | # define _GNU_SOURCE | ||
38 | #endif | ||
36 | #include <stdio.h> | 39 | #include <stdio.h> |
37 | #include <stdlib.h> | 40 | #include <stdlib.h> |
38 | #include <unistd.h> | 41 | #include <unistd.h> | ... | ... |
... | @@ -17,12 +17,10 @@ | ... | @@ -17,12 +17,10 @@ |
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
18 | MA 02110-1301 USA */ | 18 | MA 02110-1301 USA */ |
19 | 19 | ||
20 | #include "mail.h" | ||
20 | #include <sys/types.h> | 21 | #include <sys/types.h> |
21 | #include <sys/stat.h> | 22 | #include <sys/stat.h> |
22 | #include <fcntl.h> | 23 | #include <fcntl.h> |
23 | #include <stdio.h> | ||
24 | |||
25 | #include "mail.h" | ||
26 | 24 | ||
27 | static int isfilename (const char *); | 25 | static int isfilename (const char *); |
28 | static void msg_to_pipe (const char *cmd, mu_message_t msg); | 26 | static void msg_to_pipe (const char *cmd, mu_message_t msg); | ... | ... |
... | @@ -33,11 +33,10 @@ struct tree_print | ... | @@ -33,11 +33,10 @@ struct tree_print |
33 | }; | 33 | }; |
34 | 34 | ||
35 | static void | 35 | static void |
36 | format_level (struct tree_print *tp) | 36 | format_level (mu_stream_t stream, int level) |
37 | { | 37 | { |
38 | int i; | 38 | while (level--) |
39 | for (i = 0; i < tp->level; i++) | 39 | mu_stream_sequential_write (stream, " ", 2); |
40 | mu_stream_sequential_write (tp->stream, " ", 2); | ||
41 | } | 40 | } |
42 | 41 | ||
43 | static void | 42 | static void |
... | @@ -84,7 +83,7 @@ format_node (const mu_cfg_node_t *node, void *data) | ... | @@ -84,7 +83,7 @@ format_node (const mu_cfg_node_t *node, void *data) |
84 | if (node->locus.file) | 83 | if (node->locus.file) |
85 | mu_stream_sequential_printf (tp->stream, "# %d \"%s\"\n", | 84 | mu_stream_sequential_printf (tp->stream, "# %d \"%s\"\n", |
86 | node->locus.line, node->locus.file); | 85 | node->locus.line, node->locus.file); |
87 | format_level (tp); | 86 | format_level (tp->stream, tp->level); |
88 | switch (node->type) | 87 | switch (node->type) |
89 | { | 88 | { |
90 | case mu_cfg_node_undefined: | 89 | case mu_cfg_node_undefined: |
... | @@ -126,13 +125,13 @@ format_node_end (const mu_cfg_node_t *node, void *data) | ... | @@ -126,13 +125,13 @@ format_node_end (const mu_cfg_node_t *node, void *data) |
126 | { | 125 | { |
127 | struct tree_print *tp = data; | 126 | struct tree_print *tp = data; |
128 | tp->level--; | 127 | tp->level--; |
129 | format_level (tp); | 128 | format_level (tp->stream, tp->level); |
130 | mu_stream_sequential_write (tp->stream, "};\n", 3); | 129 | mu_stream_sequential_write (tp->stream, "};\n", 3); |
131 | return MU_CFG_ITER_OK; | 130 | return MU_CFG_ITER_OK; |
132 | } | 131 | } |
133 | 132 | ||
134 | void | 133 | void |
135 | mu_cfg_format_tree (mu_stream_t stream, mu_cfg_tree_t *tree) | 134 | mu_cfg_format_parse_tree (mu_stream_t stream, mu_cfg_tree_t *tree) |
136 | { | 135 | { |
137 | struct tree_print t; | 136 | struct tree_print t; |
138 | t.level = 0; | 137 | t.level = 0; |
... | @@ -142,3 +141,111 @@ mu_cfg_format_tree (mu_stream_t stream, mu_cfg_tree_t *tree) | ... | @@ -142,3 +141,111 @@ mu_cfg_format_tree (mu_stream_t stream, mu_cfg_tree_t *tree) |
142 | mu_cfg_preorder (tree->node, format_node, format_node_end, &t); | 141 | mu_cfg_preorder (tree->node, format_node, format_node_end, &t); |
143 | free (t.buf); | 142 | free (t.buf); |
144 | } | 143 | } |
144 | |||
145 | |||
146 | const char * | ||
147 | mu_cfg_data_type_string (enum mu_cfg_param_data_type type) | ||
148 | { | ||
149 | switch (type) | ||
150 | { | ||
151 | case mu_cfg_string: | ||
152 | return "string"; | ||
153 | case mu_cfg_short: | ||
154 | case mu_cfg_ushort: | ||
155 | case mu_cfg_int: | ||
156 | case mu_cfg_uint: | ||
157 | case mu_cfg_long: | ||
158 | case mu_cfg_ulong: | ||
159 | case mu_cfg_size: | ||
160 | case mu_cfg_off: | ||
161 | return "number"; | ||
162 | case mu_cfg_time: | ||
163 | return "time"; | ||
164 | case mu_cfg_bool: | ||
165 | return "boolean"; | ||
166 | case mu_cfg_ipv4: | ||
167 | return "ipv4"; | ||
168 | case mu_cfg_cidr: | ||
169 | return "cidr"; | ||
170 | case mu_cfg_host: | ||
171 | return "host"; | ||
172 | case mu_cfg_callback: | ||
173 | return "string"; /* FIXME: opaque data */ | ||
174 | } | ||
175 | return "unknown"; | ||
176 | } | ||
177 | |||
178 | static void | ||
179 | format_param (mu_stream_t stream, struct mu_cfg_param *param, int level) | ||
180 | { | ||
181 | format_level (stream, level); | ||
182 | mu_stream_sequential_printf (stream, "%s <%s>;\n", | ||
183 | param->ident, | ||
184 | mu_cfg_data_type_string (param->type)); | ||
185 | } | ||
186 | |||
187 | static void format_container (mu_stream_t stream, struct mu_cfg_cont *cont, | ||
188 | int level); | ||
189 | |||
190 | static int | ||
191 | _f_helper (void *item, void *data) | ||
192 | { | ||
193 | struct tree_print *tp = data; | ||
194 | struct mu_cfg_cont *cont = item; | ||
195 | format_container (tp->stream, cont, tp->level); | ||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | static void | ||
200 | format_section (mu_stream_t stream, struct mu_cfg_section *sect, int level) | ||
201 | { | ||
202 | struct tree_print c; | ||
203 | format_level (stream, level); | ||
204 | if (sect->ident) | ||
205 | { | ||
206 | mu_stream_sequential_write (stream, sect->ident, strlen (sect->ident)); | ||
207 | if (sect->data) | ||
208 | { | ||
209 | /* FIXME: This is wrong in general. Data is an opaque data | ||
210 | pointer. */ | ||
211 | char *s = sect->data; | ||
212 | mu_stream_sequential_write (stream, " ", 1); | ||
213 | mu_stream_sequential_write (stream, s, strlen (s)); | ||
214 | } | ||
215 | mu_stream_sequential_write (stream, " {\n", 3); | ||
216 | c.stream = stream; | ||
217 | c.level = level + 1; | ||
218 | mu_list_do (sect->subsec, _f_helper, &c); | ||
219 | mu_list_do (sect->param, _f_helper, &c); | ||
220 | format_level (stream, level); | ||
221 | mu_stream_sequential_write (stream, "};\n\n", 4); | ||
222 | } | ||
223 | else | ||
224 | { | ||
225 | c.stream = stream; | ||
226 | c.level = level; | ||
227 | mu_list_do (sect->subsec, _f_helper, &c); | ||
228 | mu_list_do (sect->param, _f_helper, &c); | ||
229 | } | ||
230 | } | ||
231 | |||
232 | static void | ||
233 | format_container (mu_stream_t stream, struct mu_cfg_cont *cont, int level) | ||
234 | { | ||
235 | switch (cont->type) | ||
236 | { | ||
237 | case mu_cfg_cont_section: | ||
238 | format_section (stream, &cont->v.section, level); | ||
239 | break; | ||
240 | |||
241 | case mu_cfg_cont_param: | ||
242 | format_param (stream, &cont->v.param, level); | ||
243 | break; | ||
244 | } | ||
245 | } | ||
246 | |||
247 | void | ||
248 | mu_cfg_format_container (mu_stream_t stream, struct mu_cfg_cont *cont) | ||
249 | { | ||
250 | format_container (stream, cont, 0); | ||
251 | } | ... | ... |
... | @@ -730,6 +730,72 @@ _cb_include (mu_debug_t debug, void *data, char *arg) | ... | @@ -730,6 +730,72 @@ _cb_include (mu_debug_t debug, void *data, char *arg) |
730 | return ret; | 730 | return ret; |
731 | } | 731 | } |
732 | 732 | ||
733 | struct mu_cfg_cont * | ||
734 | mu_build_container (const char *progname, | ||
735 | struct mu_cfg_param *progparam, int flags) | ||
736 | { | ||
737 | struct mu_cfg_cont *cont = root_container; | ||
738 | struct include_data idata; | ||
739 | struct mu_cfg_param mu_include_param[] = { | ||
740 | { "include", mu_cfg_callback, &idata, _cb_include }, | ||
741 | { NULL } | ||
742 | }; | ||
743 | |||
744 | mu_config_clone_container (cont); | ||
745 | idata.progname = progname; | ||
746 | idata.progparam = progparam; | ||
747 | idata.flags = flags & MU_PARSE_CONFIG_GLOBAL; | ||
748 | _mu_config_register_section (&cont, NULL, NULL, NULL, | ||
749 | (void*) progname, mu_include_param, NULL); | ||
750 | if (flags & MU_PARSE_CONFIG_GLOBAL) | ||
751 | { | ||
752 | mu_iterator_t iter; | ||
753 | struct mu_cfg_section *prog_sect; | ||
754 | struct mu_cfg_cont *old_root = root_container; | ||
755 | static struct mu_cfg_param empty_param = { NULL }; | ||
756 | if (!progparam) | ||
757 | progparam = &empty_param; | ||
758 | |||
759 | _mu_config_register_section (&cont, NULL, "program", prog_parser, | ||
760 | (void*) progname, | ||
761 | progparam, &prog_sect); | ||
762 | |||
763 | if (old_root->v.section.subsec) | ||
764 | { | ||
765 | if (!prog_sect->subsec) | ||
766 | mu_list_create (&prog_sect->subsec); | ||
767 | mu_list_get_iterator (old_root->v.section.subsec, &iter); | ||
768 | for (mu_iterator_first (iter); !mu_iterator_is_done (iter); | ||
769 | mu_iterator_next (iter)) | ||
770 | { | ||
771 | struct mu_cfg_cont *c; | ||
772 | mu_iterator_current (iter, (void**)&c); | ||
773 | mu_list_append (prog_sect->subsec, c); | ||
774 | } | ||
775 | mu_iterator_destroy (&iter); | ||
776 | } | ||
777 | |||
778 | if (old_root->v.section.param) | ||
779 | { | ||
780 | if (!prog_sect->param) | ||
781 | mu_list_create (&prog_sect->param); | ||
782 | mu_list_get_iterator (old_root->v.section.param, &iter); | ||
783 | for (mu_iterator_first (iter); !mu_iterator_is_done (iter); | ||
784 | mu_iterator_next (iter)) | ||
785 | { | ||
786 | struct mu_cfg_cont *c; | ||
787 | mu_iterator_current (iter, (void**)&c); | ||
788 | mu_list_append (prog_sect->param, c); | ||
789 | } | ||
790 | mu_iterator_destroy (&iter); | ||
791 | } | ||
792 | } | ||
793 | else if (progparam) | ||
794 | _mu_config_register_section (&cont, NULL, NULL, NULL, NULL, | ||
795 | progparam, NULL); | ||
796 | return cont; | ||
797 | } | ||
798 | |||
733 | int | 799 | int |
734 | mu_parse_config_tree (mu_cfg_tree_t *parse_tree, const char *progname, | 800 | mu_parse_config_tree (mu_cfg_tree_t *parse_tree, const char *progname, |
735 | struct mu_cfg_param *progparam, int flags) | 801 | struct mu_cfg_param *progparam, int flags) |
... | @@ -738,66 +804,8 @@ mu_parse_config_tree (mu_cfg_tree_t *parse_tree, const char *progname, | ... | @@ -738,66 +804,8 @@ mu_parse_config_tree (mu_cfg_tree_t *parse_tree, const char *progname, |
738 | 804 | ||
739 | if (root_container) | 805 | if (root_container) |
740 | { | 806 | { |
741 | struct mu_cfg_cont *cont = root_container; | 807 | struct mu_cfg_cont *cont = mu_build_container (progname, progparam, |
742 | struct include_data idata; | 808 | flags); |
743 | struct mu_cfg_param mu_include_param[] = { | ||
744 | { "include", mu_cfg_callback, &idata, _cb_include }, | ||
745 | { NULL } | ||
746 | }; | ||
747 | |||
748 | mu_config_clone_container (cont); | ||
749 | idata.progname = progname; | ||
750 | idata.progparam = progparam; | ||
751 | idata.flags = flags & MU_PARSE_CONFIG_GLOBAL; | ||
752 | _mu_config_register_section (&cont, NULL, NULL, NULL, | ||
753 | (void*) progname, mu_include_param, NULL); | ||
754 | if (flags & MU_PARSE_CONFIG_GLOBAL) | ||
755 | { | ||
756 | mu_iterator_t iter; | ||
757 | struct mu_cfg_section *prog_sect; | ||
758 | struct mu_cfg_cont *old_root = root_container; | ||
759 | static struct mu_cfg_param empty_param = { NULL }; | ||
760 | if (!progparam) | ||
761 | progparam = &empty_param; | ||
762 | |||
763 | _mu_config_register_section (&cont, NULL, "program", prog_parser, | ||
764 | (void*) progname, | ||
765 | progparam, &prog_sect); | ||
766 | |||
767 | if (old_root->v.section.subsec) | ||
768 | { | ||
769 | if (!prog_sect->subsec) | ||
770 | mu_list_create (&prog_sect->subsec); | ||
771 | mu_list_get_iterator (old_root->v.section.subsec, &iter); | ||
772 | for (mu_iterator_first (iter); !mu_iterator_is_done (iter); | ||
773 | mu_iterator_next (iter)) | ||
774 | { | ||
775 | struct mu_cfg_cont *c; | ||
776 | mu_iterator_current (iter, (void**)&c); | ||
777 | mu_list_append (prog_sect->subsec, c); | ||
778 | } | ||
779 | mu_iterator_destroy (&iter); | ||
780 | } | ||
781 | |||
782 | if (old_root->v.section.param) | ||
783 | { | ||
784 | if (!prog_sect->param) | ||
785 | mu_list_create (&prog_sect->param); | ||
786 | mu_list_get_iterator (old_root->v.section.param, &iter); | ||
787 | for (mu_iterator_first (iter); !mu_iterator_is_done (iter); | ||
788 | mu_iterator_next (iter)) | ||
789 | { | ||
790 | struct mu_cfg_cont *c; | ||
791 | mu_iterator_current (iter, (void**)&c); | ||
792 | mu_list_append (prog_sect->param, c); | ||
793 | } | ||
794 | mu_iterator_destroy (&iter); | ||
795 | } | ||
796 | } | ||
797 | else if (progparam) | ||
798 | _mu_config_register_section (&cont, NULL, NULL, NULL, NULL, | ||
799 | progparam, NULL); | ||
800 | |||
801 | rc = mu_cfg_scan_tree (parse_tree, &cont->v.section, (void*) progname); | 809 | rc = mu_cfg_scan_tree (parse_tree, &cont->v.section, (void*) progname); |
802 | mu_config_destroy_container (&cont); | 810 | mu_config_destroy_container (&cont); |
803 | } | 811 | } |
... | @@ -808,13 +816,22 @@ mu_parse_config_tree (mu_cfg_tree_t *parse_tree, const char *progname, | ... | @@ -808,13 +816,22 @@ mu_parse_config_tree (mu_cfg_tree_t *parse_tree, const char *progname, |
808 | mu_stdio_stream_create (&stream, stderr, | 816 | mu_stdio_stream_create (&stream, stderr, |
809 | MU_STREAM_NO_CHECK|MU_STREAM_NO_CLOSE); | 817 | MU_STREAM_NO_CHECK|MU_STREAM_NO_CLOSE); |
810 | mu_stream_open (stream); | 818 | mu_stream_open (stream); |
811 | mu_cfg_format_tree (stream, parse_tree); | 819 | mu_cfg_format_parse_tree (stream, parse_tree); |
812 | mu_stream_destroy (&stream, NULL); | 820 | mu_stream_destroy (&stream, NULL); |
813 | } | 821 | } |
814 | 822 | ||
815 | return rc; | 823 | return rc; |
816 | } | 824 | } |
817 | 825 | ||
826 | void | ||
827 | mu_format_config_tree (mu_stream_t stream, const char *progname, | ||
828 | struct mu_cfg_param *progparam, int flags) | ||
829 | { | ||
830 | struct mu_cfg_cont *cont = mu_build_container (progname, progparam, flags); | ||
831 | mu_cfg_format_container (stream, cont); | ||
832 | mu_config_destroy_container (&cont); | ||
833 | } | ||
834 | |||
818 | static int | 835 | static int |
819 | _mu_parse_config (const char *file, const char *progname, | 836 | _mu_parse_config (const char *file, const char *progname, |
820 | struct mu_cfg_param *progparam, int flags) | 837 | struct mu_cfg_param *progparam, int flags) | ... | ... |
... | @@ -1110,8 +1110,10 @@ mu_cfg_tree_free (struct mu_cfg_tree *tree, void *mem) | ... | @@ -1110,8 +1110,10 @@ mu_cfg_tree_free (struct mu_cfg_tree *tree, void *mem) |
1110 | 1110 | ||
1111 | mu_cfg_node_t * | 1111 | mu_cfg_node_t * |
1112 | mu_cfg_tree_create_node (struct mu_cfg_tree *tree, | 1112 | mu_cfg_tree_create_node (struct mu_cfg_tree *tree, |
1113 | enum mu_cfg_node_type type, mu_cfg_locus_t *loc, | 1113 | enum mu_cfg_node_type type, |
1114 | char *tag, char *label, mu_cfg_node_t *node) | 1114 | const mu_cfg_locus_t *loc, |
1115 | const char *tag, const char *label, | ||
1116 | mu_cfg_node_t *node) | ||
1115 | { | 1117 | { |
1116 | char *p; | 1118 | char *p; |
1117 | mu_cfg_node_t *np; | 1119 | mu_cfg_node_t *np; |
... | @@ -1139,7 +1141,7 @@ mu_cfg_tree_create_node (struct mu_cfg_tree *tree, | ... | @@ -1139,7 +1141,7 @@ mu_cfg_tree_create_node (struct mu_cfg_tree *tree, |
1139 | strcpy (p, label); | 1141 | strcpy (p, label); |
1140 | } | 1142 | } |
1141 | else | 1143 | else |
1142 | np->tag_label = label; | 1144 | np->tag_label = NULL; |
1143 | np->node = node; | 1145 | np->node = node; |
1144 | np->next = NULL; | 1146 | np->next = NULL; |
1145 | return np; | 1147 | return np; | ... | ... |
... | @@ -239,7 +239,7 @@ mu_gocs_debug_init (void *data) | ... | @@ -239,7 +239,7 @@ mu_gocs_debug_init (void *data) |
239 | 239 | ||
240 | struct mu_gocs_entry | 240 | struct mu_gocs_entry |
241 | { | 241 | { |
242 | char *name; | 242 | const char *name; |
243 | gocs_init_fp init; | 243 | gocs_init_fp init; |
244 | }; | 244 | }; |
245 | 245 | ||
... | @@ -248,7 +248,7 @@ struct mu_gocs_entry | ... | @@ -248,7 +248,7 @@ struct mu_gocs_entry |
248 | static struct mu_gocs_entry _gocs_table[MAX_GOCS]; | 248 | static struct mu_gocs_entry _gocs_table[MAX_GOCS]; |
249 | 249 | ||
250 | void | 250 | void |
251 | mu_gocs_register (char *capa, gocs_init_fp init) | 251 | mu_gocs_register (const char *capa, gocs_init_fp init) |
252 | { | 252 | { |
253 | int i; | 253 | int i; |
254 | for (i = 0; _gocs_table[i].name; i++) | 254 | for (i = 0; _gocs_table[i].name; i++) |
... | @@ -268,7 +268,7 @@ mu_gocs_enumerate (mu_list_action_t action, void *data) | ... | @@ -268,7 +268,7 @@ mu_gocs_enumerate (mu_list_action_t action, void *data) |
268 | 268 | ||
269 | for (i = 0; _gocs_table[i].name; i++) | 269 | for (i = 0; _gocs_table[i].name; i++) |
270 | { | 270 | { |
271 | int rc = action (_gocs_table[i].name, data); | 271 | int rc = action ((void*) _gocs_table[i].name, data); |
272 | if (rc) | 272 | if (rc) |
273 | return rc; | 273 | return rc; |
274 | } | 274 | } | ... | ... |
... | @@ -658,7 +658,7 @@ mu_tempname (const char *tmpdir) | ... | @@ -658,7 +658,7 @@ mu_tempname (const char *tmpdir) |
658 | * to find it. | 658 | * to find it. |
659 | */ | 659 | */ |
660 | int | 660 | int |
661 | mu_spawnvp (const char *prog, char * const av[], int *stat) | 661 | mu_spawnvp (const char *prog, char *av[], int *stat) |
662 | { | 662 | { |
663 | pid_t pid; | 663 | pid_t pid; |
664 | int err = 0; | 664 | int err = 0; | ... | ... |
... | @@ -242,7 +242,7 @@ invoke (const char *compname, const char *defval, int argc, char **argv, | ... | @@ -242,7 +242,7 @@ invoke (const char *compname, const char *defval, int argc, char **argv, |
242 | const char *extra0, const char *extra1) | 242 | const char *extra0, const char *extra1) |
243 | { | 243 | { |
244 | int i, rc; | 244 | int i, rc; |
245 | const char **xargv; | 245 | char **xargv; |
246 | const char *progname; | 246 | const char *progname; |
247 | int status; | 247 | int status; |
248 | 248 | ... | ... |
... | @@ -26,6 +26,9 @@ | ... | @@ -26,6 +26,9 @@ |
26 | #include <sys/wait.h> | 26 | #include <sys/wait.h> |
27 | 27 | ||
28 | #include "mailutils/libargp.h" | 28 | #include "mailutils/libargp.h" |
29 | #include "mailutils/argcv.h" | ||
30 | |||
31 | #include "mailcap.h" | ||
29 | 32 | ||
30 | const char *program_version = "mimeview (" PACKAGE_STRING ")"; | 33 | const char *program_version = "mimeview (" PACKAGE_STRING ")"; |
31 | static char doc[] = N_("GNU mimeview -- display files, using mailcap mechanism.") | 34 | static char doc[] = N_("GNU mimeview -- display files, using mailcap mechanism.") |
... | @@ -209,7 +212,7 @@ display_file (const char *type) | ... | @@ -209,7 +212,7 @@ display_file (const char *type) |
209 | 212 | ||
210 | if (metamail) | 213 | if (metamail) |
211 | { | 214 | { |
212 | const char *argv[7]; | 215 | char *argv[7]; |
213 | 216 | ||
214 | argv[0] = "metamail"; | 217 | argv[0] = "metamail"; |
215 | argv[1] = "-b"; | 218 | argv[1] = "-b"; |
... | @@ -217,7 +220,7 @@ display_file (const char *type) | ... | @@ -217,7 +220,7 @@ display_file (const char *type) |
217 | argv[2] = interactive ? "-p" : "-h"; | 220 | argv[2] = interactive ? "-p" : "-h"; |
218 | 221 | ||
219 | argv[3] = "-c"; | 222 | argv[3] = "-c"; |
220 | argv[4] = type; | 223 | argv[4] = (char*) type; |
221 | argv[5] = mimeview_file; | 224 | argv[5] = mimeview_file; |
222 | argv[6] = NULL; | 225 | argv[6] = NULL; |
223 | 226 | ... | ... |
... | @@ -24,6 +24,7 @@ | ... | @@ -24,6 +24,7 @@ |
24 | #include "readmsg.h" | 24 | #include "readmsg.h" |
25 | #include "xalloc.h" | 25 | #include "xalloc.h" |
26 | #include "mailutils/libargp.h" | 26 | #include "mailutils/libargp.h" |
27 | #include "mu_umaxtostr.h" | ||
27 | 28 | ||
28 | #define WEEDLIST_SEPARATOR " :," | 29 | #define WEEDLIST_SEPARATOR " :," |
29 | 30 | ... | ... |
... | @@ -174,7 +174,6 @@ static error_t | ... | @@ -174,7 +174,6 @@ static error_t |
174 | parser (int key, char *arg, struct argp_state *state) | 174 | parser (int key, char *arg, struct argp_state *state) |
175 | { | 175 | { |
176 | static struct mu_argp_node_list lst; | 176 | static struct mu_argp_node_list lst; |
177 | int rc; | ||
178 | 177 | ||
179 | switch (key) | 178 | switch (key) |
180 | { | 179 | { | ... | ... |
-
Please register or sign in to post a comment