Commit 96dc9ab9 96dc9ab99e9518f5f21a7710e396da8c3fd833b5 by Sergey Poznyakoff

Add TLS to MH. Handle --debug-level and --debug-line-info options.

* mailbox/mbx_default.c (attach_auth_ticket): Do not
proceed if auth is NULL.
* mh/mh_getopt.h (struct mh_argp_data): Change return type
and signature of handler.
(mh_argp_parse): Likewise.
* mh/mh_argp.c (parse_opt): Rewrite using new
handler prototype.
(mh_argp_parse): Use new hanlder type.
Assign argp children.

* mh/mh_init.c (mh_init): Call mu_init_tls_libs.

* mh/ali.c: Update opt_handler
* mh/anno.c: Update opt_handler
* mh/burst.c: Update opt_handler
* mh/comp.c: Update opt_handler
* mh/fmtcheck.c: Update opt_handler
* mh/folder.c: Update opt_handler
* mh/forw.c: Update opt_handler
* mh/inc.c: Update opt_handler
* mh/install-mh.c: Update opt_handler
* mh/mark.c: Update opt_handler
* mh/mhl.c: Update opt_handler
* mh/mhn.c: Update opt_handler
* mh/mhparam.c: Update opt_handler
* mh/mhpath.c: Update opt_handler
* mh/pick.c: Update opt_handler
* mh/refile.c: Update opt_handler
* mh/repl.c: Update opt_handler
* mh/rmf.c: Update opt_handler
* mh/rmm.c: Update opt_handler
* mh/scan.c: Update opt_handler
* mh/send.c: Update opt_handler
* mh/sortm.c: Update opt_handler
* mh/whatnow.c: Update opt_handler
* mh/whom.c: Update opt_handler
1 parent b66ffedc
...@@ -340,7 +340,8 @@ attach_auth_ticket (mu_mailbox_t mbox) ...@@ -340,7 +340,8 @@ attach_auth_ticket (mu_mailbox_t mbox)
340 mu_authority_t auth = NULL; 340 mu_authority_t auth = NULL;
341 341
342 if (mu_mailbox_get_folder (mbox, &folder) == 0 342 if (mu_mailbox_get_folder (mbox, &folder) == 0
343 && mu_folder_get_authority (folder, &auth) == 0) 343 && mu_folder_get_authority (folder, &auth) == 0
344 && auth)
344 { 345 {
345 char *filename = mu_tilde_expansion (mu_ticket_file, "/", NULL); 346 char *filename = mu_tilde_expansion (mu_ticket_file, "/", NULL);
346 mu_wicket_t wicket; 347 mu_wicket_t wicket;
......
...@@ -64,8 +64,8 @@ static int user_mode; ...@@ -64,8 +64,8 @@ static int user_mode;
64 static int normalize_mode; 64 static int normalize_mode;
65 static int nolist_mode; 65 static int nolist_mode;
66 66
67 static int 67 static error_t
68 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 68 opt_handler (int key, char *arg, struct argp_state *state)
69 { 69 {
70 switch (key) 70 switch (key)
71 { 71 {
...@@ -94,7 +94,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -94,7 +94,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
94 break; 94 break;
95 95
96 default: 96 default:
97 return 1; 97 return ARGP_ERR_UNKNOWN;
98 } 98 }
99 return 0; 99 return 0;
100 } 100 }
......
...@@ -58,8 +58,8 @@ static int anno_date = 1; /* Add date to the annotation */ ...@@ -58,8 +58,8 @@ static int anno_date = 1; /* Add date to the annotation */
58 static char *component; /* header field */ 58 static char *component; /* header field */
59 static char *anno_text; /* header field value */ 59 static char *anno_text; /* header field value */
60 60
61 static int 61 static error_t
62 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 62 opt_handler (int key, char *arg, struct argp_state *state)
63 { 63 {
64 switch (key) 64 switch (key)
65 { 65 {
...@@ -96,7 +96,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -96,7 +96,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
96 break; 96 break;
97 97
98 default: 98 default:
99 return 1; 99 return ARGP_ERR_UNKNOWN;
100 } 100 }
101 return 0; 101 return 0;
102 } 102 }
......
...@@ -69,8 +69,8 @@ int eb_min_length = 1; /* Minimal length of encapsulation boundary */ ...@@ -69,8 +69,8 @@ int eb_min_length = 1; /* Minimal length of encapsulation boundary */
69 69
70 #define VERBOSE(c) do { if (verbose) { printf c; putchar ('\n'); } } while (0) 70 #define VERBOSE(c) do { if (verbose) { printf c; putchar ('\n'); } } while (0)
71 71
72 static int 72 static error_t
73 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 73 opt_handler (int key, char *arg, struct argp_state *state)
74 { 74 {
75 switch (key) 75 switch (key)
76 { 76 {
...@@ -121,7 +121,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -121,7 +121,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
121 break; 121 break;
122 122
123 default: 123 default:
124 return 1; 124 return ARGP_ERR_UNKNOWN;
125 } 125 }
126 return 0; 126 return 0;
127 } 127 }
......
...@@ -83,8 +83,8 @@ static int build_only = 0; /* --build flag */ ...@@ -83,8 +83,8 @@ static int build_only = 0; /* --build flag */
83 static int use_draft = 0; /* --use flag */ 83 static int use_draft = 0; /* --use flag */
84 static char *draftmessage = "new"; 84 static char *draftmessage = "new";
85 85
86 static int 86 static error_t
87 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 87 opt_handler (int key, char *arg, struct argp_state *state)
88 { 88 {
89 switch (key) 89 switch (key)
90 { 90 {
...@@ -148,7 +148,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -148,7 +148,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
148 break; 148 break;
149 149
150 default: 150 default:
151 return 1; 151 return ARGP_ERR_UNKNOWN;
152 } 152 }
153 return 0; 153 return 0;
154 } 154 }
......
...@@ -68,8 +68,8 @@ action_dump () ...@@ -68,8 +68,8 @@ action_dump ()
68 68
69 static action_fp action = action_dump; 69 static action_fp action = action_dump;
70 70
71 static int 71 static error_t
72 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 72 opt_handler (int key, char *arg, struct argp_state *state)
73 { 73 {
74 switch (key) 74 switch (key)
75 { 75 {
...@@ -94,7 +94,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -94,7 +94,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
94 break; 94 break;
95 95
96 default: 96 default:
97 return 1; 97 return ARGP_ERR_UNKNOWN;
98 } 98 }
99 return 0; 99 return 0;
100 } 100 }
......
...@@ -136,7 +136,7 @@ size_t max_depth = 1; /* Maximum recursion depth (0 means infinity) */ ...@@ -136,7 +136,7 @@ size_t max_depth = 1; /* Maximum recursion depth (0 means infinity) */
136 #define OPTION_IS_SET(opt) ((opt) == -1 ? show_all : opt) 136 #define OPTION_IS_SET(opt) ((opt) == -1 ? show_all : opt)
137 137
138 static int 138 static int
139 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 139 opt_handler (int key, char *arg, struct argp_state *state)
140 { 140 {
141 switch (key) 141 switch (key)
142 { 142 {
...@@ -234,7 +234,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -234,7 +234,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
234 break; 234 break;
235 235
236 default: 236 default:
237 return 1; 237 return ARGP_ERR_UNKNOWN;
238 } 238 }
239 return 0; 239 return 0;
240 } 240 }
......
...@@ -117,7 +117,7 @@ static mh_msgset_t msgset; ...@@ -117,7 +117,7 @@ static mh_msgset_t msgset;
117 static mu_mailbox_t mbox; 117 static mu_mailbox_t mbox;
118 118
119 static int 119 static int
120 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 120 opt_handler (int key, char *arg, struct argp_state *state)
121 { 121 {
122 switch (key) 122 switch (key)
123 { 123 {
...@@ -214,7 +214,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -214,7 +214,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
214 break; 214 break;
215 215
216 default: 216 default:
217 return 1; 217 return ARGP_ERR_UNKNOWN;
218 } 218 }
219 return 0; 219 return 0;
220 } 220 }
......
...@@ -79,8 +79,8 @@ static int truncate_source = -1; ...@@ -79,8 +79,8 @@ static int truncate_source = -1;
79 static int quiet = 0; 79 static int quiet = 0;
80 static const char *append_folder; 80 static const char *append_folder;
81 81
82 static int 82 static error_t
83 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 83 opt_handler (int key, char *arg, struct argp_state *state)
84 { 84 {
85 switch (key) 85 switch (key)
86 { 86 {
...@@ -147,7 +147,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -147,7 +147,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
147 break; 147 break;
148 148
149 default: 149 default:
150 return 1; 150 return ARGP_ERR_UNKNOWN;
151 } 151 }
152 return 0; 152 return 0;
153 } 153 }
......
...@@ -40,8 +40,8 @@ struct mh_option mh_option[] = { ...@@ -40,8 +40,8 @@ struct mh_option mh_option[] = {
40 40
41 int automode; 41 int automode;
42 42
43 static int 43 static error_t
44 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 44 opt_handler (int key, char *arg, struct argp_state *state)
45 { 45 {
46 switch (key) 46 switch (key)
47 { 47 {
...@@ -57,7 +57,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -57,7 +57,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
57 break; 57 break;
58 58
59 default: 59 default:
60 return 1; 60 return ARGP_ERR_UNKNOWN;
61 } 61 }
62 return 0; 62 return 0;
63 } 63 }
......
...@@ -75,8 +75,8 @@ add_sequence (char *name) ...@@ -75,8 +75,8 @@ add_sequence (char *name)
75 mu_list_append (seq_list, name); 75 mu_list_append (seq_list, name);
76 } 76 }
77 77
78 static int 78 static error_t
79 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 79 opt_handler (int key, char *arg, struct argp_state *state)
80 { 80 {
81 switch (key) 81 switch (key)
82 { 82 {
...@@ -121,7 +121,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -121,7 +121,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
121 break; 121 break;
122 122
123 default: 123 default:
124 return 1; 124 return ARGP_ERR_UNKNOWN;
125 } 125 }
126 return 0; 126 return 0;
127 } 127 }
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2002, 2005, 2 Copyright (C) 1999, 2000, 2001, 2002, 2005,
3 2006, 2007 Free Software Foundation, Inc. 3 2006, 2007, 2009 Free Software Foundation, Inc.
4 4
5 GNU Mailutils is free software; you can redistribute it and/or modify 5 GNU Mailutils is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
...@@ -33,26 +33,25 @@ static error_t ...@@ -33,26 +33,25 @@ static error_t
33 parse_opt (int key, char *arg, struct argp_state *state) 33 parse_opt (int key, char *arg, struct argp_state *state)
34 { 34 {
35 struct mh_argp_data *data = state->input; 35 struct mh_argp_data *data = state->input;
36 error_t ret = ARGP_ERR_UNKNOWN;
37
36 switch (key) 38 switch (key)
37 { 39 {
38 case ARGP_KEY_ARG: 40 case ARGP_KEY_ARG:
39 if (arg[0] == '+') 41 if (arg[0] == '+')
40 { 42 ret = data->handler (ARG_FOLDER, arg + 1, state);
41 data->handler (ARG_FOLDER, arg + 1, data->closure);
42 break; 43 break;
43 }
44 return ARGP_ERR_UNKNOWN;
45 44
46 default: 45 default:
47 if (data->handler (key, arg, data->closure, state) == 0) 46 ret = data->handler (key, arg, state);
47 if (ret == 0)
48 { 48 {
49 if (key == ARGP_KEY_ERROR) 49 if (key == ARGP_KEY_ERROR)
50 data->errind = state->next; 50 data->errind = state->next;
51 break;
52 } 51 }
53 return ARGP_ERR_UNKNOWN;
54 } 52 }
55 return 0; 53
54 return ret;
56 } 55 }
57 56
58 static int 57 static int
...@@ -101,13 +100,59 @@ mh_argp_init (const char *vers) ...@@ -101,13 +100,59 @@ mh_argp_init (const char *vers)
101 argp_program_bug_address = "<" PACKAGE_BUGREPORT ">"; 100 argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
102 } 101 }
103 102
103
104 enum
105 {
106 OPT_DEBUG_LEVEL = 256,
107 OPT_DEBUG_LINE_INFO,
108 };
109
110 static struct argp_option mu_debug_argp_options[] =
111 {
112 { "debug-level", OPT_DEBUG_LEVEL, N_("LEVEL"), 0,
113 N_("set Mailutils debugging level"), 0 },
114 { "debug-line-info", OPT_DEBUG_LINE_INFO, NULL, 0,
115 N_("show source info with debugging messages"), 0 },
116 { NULL }
117 };
118
119 static error_t
120 mu_debug_argp_parser (int key, char *arg, struct argp_state *state)
121 {
122 switch (key)
123 {
124 case OPT_DEBUG_LEVEL:
125 mu_global_debug_from_string (arg, "command line");
126 break;
127
128 case OPT_DEBUG_LINE_INFO:
129 mu_debug_line_info = 1;
130 break;
131
132 default:
133 return ARGP_ERR_UNKNOWN;
134 }
135 return 0;
136 }
137
138 struct argp mu_debug_argp = {
139 mu_debug_argp_options,
140 mu_debug_argp_parser,
141 };
142
143 struct argp_child mh_argp_children[] = {
144 { &mu_debug_argp, 0, N_("Global debugging settings"), 0 },
145 { NULL }
146 };
147
104 int 148 int
105 mh_argp_parse (int *pargc, char **pargv[], 149 mh_argp_parse (int *pargc, char **pargv[],
106 int flags, 150 int flags,
107 struct argp_option *option, 151 struct argp_option *option,
108 struct mh_option *mh_option, 152 struct mh_option *mh_option,
109 char *argp_doc, char *doc, 153 char *argp_doc, char *doc,
110 int (*handler)(), void *closure, int *pindex) 154 argp_parser_t handler,
155 void *closure, int *pindex)
111 { 156 {
112 struct argp argp; 157 struct argp argp;
113 struct mh_argp_data data; 158 struct mh_argp_data data;
...@@ -123,6 +168,7 @@ mh_argp_parse (int *pargc, char **pargv[], ...@@ -123,6 +168,7 @@ mh_argp_parse (int *pargc, char **pargv[],
123 argp.parser = parse_opt; 168 argp.parser = parse_opt;
124 argp.args_doc = argp_doc; 169 argp.args_doc = argp_doc;
125 argp.doc = doc; 170 argp.doc = doc;
171 argp.children = mh_argp_children;
126 data.mh_option = mh_option; 172 data.mh_option = mh_option;
127 data.closure = closure; 173 data.closure = closure;
128 data.handler = handler; 174 data.handler = handler;
......
...@@ -34,7 +34,7 @@ struct mh_option ...@@ -34,7 +34,7 @@ struct mh_option
34 struct mh_argp_data 34 struct mh_argp_data
35 { 35 {
36 struct mh_option *mh_option; 36 struct mh_option *mh_option;
37 int (*handler)(); 37 argp_parser_t handler;
38 int errind; 38 int errind;
39 void *closure; 39 void *closure;
40 char *doc; 40 char *doc;
...@@ -190,7 +190,8 @@ int mh_argp_parse (int *argc, char **argv[], ...@@ -190,7 +190,8 @@ int mh_argp_parse (int *argc, char **argv[],
190 struct argp_option *option, 190 struct argp_option *option,
191 struct mh_option *mh_option, 191 struct mh_option *mh_option,
192 char *argp_doc, char *doc, 192 char *argp_doc, char *doc,
193 int (*handler)(), void *closure, int *index); 193 argp_parser_t handler,
194 void *closure, int *index);
194 195
195 void mh_help (struct mh_option *mh_option, const char *doc); 196 void mh_help (struct mh_option *mh_option, const char *doc);
196 void mh_license (const char *name); 197 void mh_license (const char *name);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
21 21
22 #include <mh.h> 22 #include <mh.h>
23 #include <mailutils/url.h> 23 #include <mailutils/url.h>
24 #include <mailutils/tls.h>
24 #include <pwd.h> 25 #include <pwd.h>
25 #include <sys/types.h> 26 #include <sys/types.h>
26 #include <sys/stat.h> 27 #include <sys/stat.h>
...@@ -46,6 +47,9 @@ mh_init () ...@@ -46,6 +47,9 @@ mh_init ()
46 { 47 {
47 /* Register all mailbox and mailer formats */ 48 /* Register all mailbox and mailer formats */
48 mu_register_all_formats (); 49 mu_register_all_formats ();
50 #ifdef WITH_TLS
51 mu_init_tls_libs ();
52 #endif
49 53
50 /* Read user's profile */ 54 /* Read user's profile */
51 mh_read_profile (); 55 mh_read_profile ();
......
...@@ -75,8 +75,8 @@ static int nomoreproc; ...@@ -75,8 +75,8 @@ static int nomoreproc;
75 75
76 static mu_list_t format; 76 static mu_list_t format;
77 77
78 static int 78 static error_t
79 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 79 opt_handler (int key, char *arg, struct argp_state *state)
80 { 80 {
81 switch (key) 81 switch (key)
82 { 82 {
...@@ -137,7 +137,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -137,7 +137,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
137 break; 137 break;
138 138
139 default: 139 default:
140 return 1; 140 return ARGP_ERR_UNKNOWN;
141 } 141 }
142 return 0; 142 return 0;
143 } 143 }
......
...@@ -242,8 +242,8 @@ _get_content_encoding (mu_header_t hdr, char **value) ...@@ -242,8 +242,8 @@ _get_content_encoding (mu_header_t hdr, char **value)
242 return 0; 242 return 0;
243 } 243 }
244 244
245 static int 245 static error_t
246 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 246 opt_handler (int key, char *arg, struct argp_state *state)
247 { 247 {
248 switch (key) 248 switch (key)
249 { 249 {
...@@ -398,7 +398,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -398,7 +398,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
398 break; 398 break;
399 399
400 default: 400 default:
401 return 1; 401 return ARGP_ERR_UNKNOWN;
402 } 402 }
403 return 0; 403 return 0;
404 } 404 }
......
...@@ -46,8 +46,8 @@ struct mh_option mh_option[] = { ...@@ -46,8 +46,8 @@ struct mh_option mh_option[] = {
46 static int display_all; 46 static int display_all;
47 static int display_comp_name = -1; 47 static int display_comp_name = -1;
48 48
49 static int 49 static error_t
50 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 50 opt_handler (int key, char *arg, struct argp_state *state)
51 { 51 {
52 switch (key) 52 switch (key)
53 { 53 {
...@@ -64,7 +64,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -64,7 +64,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
64 break; 64 break;
65 65
66 default: 66 default:
67 return 1; 67 return ARGP_ERR_UNKNOWN;
68 } 68 }
69 return 0; 69 return 0;
70 } 70 }
......
...@@ -39,8 +39,8 @@ struct mh_option mh_option[] = { ...@@ -39,8 +39,8 @@ struct mh_option mh_option[] = {
39 { 0 } 39 { 0 }
40 }; 40 };
41 41
42 static int 42 static error_t
43 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 43 opt_handler (int key, char *arg, struct argp_state *state)
44 { 44 {
45 switch (key) 45 switch (key)
46 { 46 {
...@@ -53,7 +53,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -53,7 +53,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
53 break; 53 break;
54 54
55 default: 55 default:
56 return 1; 56 return ARGP_ERR_UNKNOWN;
57 } 57 }
58 return 0; 58 return 0;
59 } 59 }
......
...@@ -143,8 +143,8 @@ add_sequence (char *name) ...@@ -143,8 +143,8 @@ add_sequence (char *name)
143 mu_list_append (seq_list, name); 143 mu_list_append (seq_list, name);
144 } 144 }
145 145
146 static int 146 static error_t
147 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 147 opt_handler (int key, char *arg, struct argp_state *state)
148 { 148 {
149 char *s, *p; 149 char *s, *p;
150 150
...@@ -291,7 +291,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -291,7 +291,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
291 break; 291 break;
292 292
293 default: 293 default:
294 return 1; 294 return ARGP_ERR_UNKNOWN;
295 } 295 }
296 296
297 return 0; 297 return 0;
......
...@@ -151,7 +151,7 @@ close_folders () ...@@ -151,7 +151,7 @@ close_folders ()
151 } 151 }
152 152
153 static int 153 static int
154 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 154 opt_handler (int key, char *arg, struct argp_state *state)
155 { 155 {
156 switch (key) 156 switch (key)
157 { 157 {
...@@ -184,7 +184,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -184,7 +184,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
184 break; 184 break;
185 185
186 default: 186 default:
187 return 1; 187 return ARGP_ERR_UNKNOWN;
188 } 188 }
189 return 0; 189 return 0;
190 } 190 }
......
...@@ -138,8 +138,8 @@ decode_cc_flag (const char *opt, const char *arg) ...@@ -138,8 +138,8 @@ decode_cc_flag (const char *opt, const char *arg)
138 return rc; 138 return rc;
139 } 139 }
140 140
141 static int 141 static error_t
142 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 142 opt_handler (int key, char *arg, struct argp_state *state)
143 { 143 {
144 char *s; 144 char *s;
145 145
...@@ -271,7 +271,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -271,7 +271,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
271 break; 271 break;
272 272
273 default: 273 default:
274 return 1; 274 return ARGP_ERR_UNKNOWN;
275 } 275 }
276 return 0; 276 return 0;
277 } 277 }
......
...@@ -64,8 +64,8 @@ static char *cur_folder_path; /* Full pathname of the current folder */ ...@@ -64,8 +64,8 @@ static char *cur_folder_path; /* Full pathname of the current folder */
64 static char *folder_name; /* Name of the (topmost) folder to be 64 static char *folder_name; /* Name of the (topmost) folder to be
65 deleted */ 65 deleted */
66 66
67 static int 67 static error_t
68 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 68 opt_handler (int key, char *arg, struct argp_state *state)
69 { 69 {
70 switch (key) 70 switch (key)
71 { 71 {
...@@ -95,7 +95,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -95,7 +95,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
95 break; 95 break;
96 96
97 default: 97 default:
98 return 1; 98 return ARGP_ERR_UNKNOWN;
99 } 99 }
100 return 0; 100 return 0;
101 } 101 }
......
...@@ -39,8 +39,8 @@ struct mh_option mh_option[] = { ...@@ -39,8 +39,8 @@ struct mh_option mh_option[] = {
39 { 0 } 39 { 0 }
40 }; 40 };
41 41
42 static int 42 static error_t
43 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 43 opt_handler (int key, char *arg, struct argp_state *state)
44 { 44 {
45 switch (key) 45 switch (key)
46 { 46 {
...@@ -53,7 +53,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -53,7 +53,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
53 break; 53 break;
54 54
55 default: 55 default:
56 return 1; 56 return ARGP_ERR_UNKNOWN;
57 } 57 }
58 return 0; 58 return 0;
59 } 59 }
......
...@@ -87,8 +87,8 @@ void list_message (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data); ...@@ -87,8 +87,8 @@ void list_message (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data);
87 void print_header (mu_mailbox_t mbox); 87 void print_header (mu_mailbox_t mbox);
88 void clear_screen (void); 88 void clear_screen (void);
89 89
90 static int 90 static error_t
91 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 91 opt_handler (int key, char *arg, struct argp_state *state)
92 { 92 {
93 switch (key) 93 switch (key)
94 { 94 {
...@@ -142,7 +142,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -142,7 +142,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
142 break; 142 break;
143 143
144 default: 144 default:
145 return 1; 145 return ARGP_ERR_UNKNOWN;
146 } 146 }
147 return 0; 147 return 0;
148 } 148 }
......
...@@ -131,8 +131,8 @@ static int keep_files; /* Keep draft files */ ...@@ -131,8 +131,8 @@ static int keep_files; /* Keep draft files */
131 watch_printf c;\ 131 watch_printf c;\
132 } while (0) 132 } while (0)
133 133
134 static int 134 static error_t
135 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 135 opt_handler (int key, char *arg, struct argp_state *state)
136 { 136 {
137 char *p; 137 char *p;
138 138
...@@ -257,7 +257,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -257,7 +257,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
257 break; 257 break;
258 258
259 default: 259 default:
260 return 1; 260 return ARGP_ERR_UNKNOWN;
261 } 261 }
262 return 0; 262 return 0;
263 } 263 }
......
...@@ -116,8 +116,8 @@ static int comp_text (void *a, void *b); ...@@ -116,8 +116,8 @@ static int comp_text (void *a, void *b);
116 static int comp_date (void *a, void *b); 116 static int comp_date (void *a, void *b);
117 static int comp_number (void *a, void *b); 117 static int comp_number (void *a, void *b);
118 118
119 static int 119 static error_t
120 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 120 opt_handler (int key, char *arg, struct argp_state *state)
121 { 121 {
122 switch (key) 122 switch (key)
123 { 123 {
...@@ -196,7 +196,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -196,7 +196,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
196 break; 196 break;
197 197
198 default: 198 default:
199 return 1; 199 return ARGP_ERR_UNKNOWN;
200 } 200 }
201 return 0; 201 return 0;
202 } 202 }
......
...@@ -57,8 +57,8 @@ struct mh_whatnow_env wh_env = { 0 }; ...@@ -57,8 +57,8 @@ struct mh_whatnow_env wh_env = { 0 };
57 static int initial_edit = 1; 57 static int initial_edit = 1;
58 static char *draftmessage = "cur"; 58 static char *draftmessage = "cur";
59 59
60 static int 60 static error_t
61 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 61 opt_handler (int key, char *arg, struct argp_state *state)
62 { 62 {
63 switch (key) 63 switch (key)
64 { 64 {
...@@ -96,7 +96,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -96,7 +96,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
96 break; 96 break;
97 97
98 default: 98 default:
99 return 1; 99 return ARGP_ERR_UNKNOWN;
100 } 100 }
101 return 0; 101 return 0;
102 } 102 }
......
...@@ -60,8 +60,8 @@ static int check_recipients; ...@@ -60,8 +60,8 @@ static int check_recipients;
60 static int use_draft; /* Use the prepared draft */ 60 static int use_draft; /* Use the prepared draft */
61 static const char *draft_folder; /* Use this draft folder */ 61 static const char *draft_folder; /* Use this draft folder */
62 62
63 static int 63 static error_t
64 opt_handler (int key, char *arg, void *unused, struct argp_state *state) 64 opt_handler (int key, char *arg, struct argp_state *state)
65 { 65 {
66 switch (key) 66 switch (key)
67 { 67 {
...@@ -100,7 +100,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -100,7 +100,7 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
100 break; 100 break;
101 101
102 default: 102 default:
103 return 1; 103 return ARGP_ERR_UNKNOWN;
104 } 104 }
105 return 0; 105 return 0;
106 } 106 }
......