(mu_common_argp_parser): Handle ARGP_KEY_FINI case.
(mu_argp_error_code): new global. Specifies exit code for exits on error.
Showing
1 changed file
with
13 additions
and
0 deletions
... | @@ -127,6 +127,7 @@ struct argp_child mu_daemon_argp_child[] = | ... | @@ -127,6 +127,7 @@ struct argp_child mu_daemon_argp_child[] = |
127 | 127 | ||
128 | char *maildir = MU_PATH_MAILDIR; | 128 | char *maildir = MU_PATH_MAILDIR; |
129 | int log_facility = LOG_FACILITY; | 129 | int log_facility = LOG_FACILITY; |
130 | int mu_argp_error_code = 1; | ||
130 | 131 | ||
131 | static int | 132 | static int |
132 | parse_log_facility (const char *str) | 133 | parse_log_facility (const char *str) |
... | @@ -192,6 +193,8 @@ char *pam_service = NULL; | ... | @@ -192,6 +193,8 @@ char *pam_service = NULL; |
192 | static error_t | 193 | static error_t |
193 | mu_common_argp_parser (int key, char *arg, struct argp_state *state) | 194 | mu_common_argp_parser (int key, char *arg, struct argp_state *state) |
194 | { | 195 | { |
196 | char *p; | ||
197 | |||
195 | switch (key) | 198 | switch (key) |
196 | { | 199 | { |
197 | case 'm': | 200 | case 'm': |
... | @@ -251,6 +254,16 @@ mu_common_argp_parser (int key, char *arg, struct argp_state *state) | ... | @@ -251,6 +254,16 @@ mu_common_argp_parser (int key, char *arg, struct argp_state *state) |
251 | break; | 254 | break; |
252 | 255 | ||
253 | #endif | 256 | #endif |
257 | case ARGP_KEY_FINI: | ||
258 | p = mu_normalize_maildir (maildir); | ||
259 | if (!p) | ||
260 | { | ||
261 | mu_error ("Badly formed maildir: %s", maildir); | ||
262 | exit (mu_argp_error_code); | ||
263 | } | ||
264 | maildir = p; | ||
265 | break; | ||
266 | |||
254 | default: | 267 | default: |
255 | return ARGP_ERR_UNKNOWN; | 268 | return ARGP_ERR_UNKNOWN; |
256 | } | 269 | } | ... | ... |
-
Please register or sign in to post a comment