Commit b52e5485 b52e54859e033b90da6a1a1a4cd8a0ca16bfe5bc by Sergey Poznyakoff

(mu_mailbox_argp_option,mu_common_argp_parser): New option --mailbox-type

1 parent f9361439
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
54 #define ARG_LOCK_EXTERNAL_PROGRAM 6 54 #define ARG_LOCK_EXTERNAL_PROGRAM 6
55 #define ARG_SHOW_OPTIONS 7 55 #define ARG_SHOW_OPTIONS 7
56 #define ARG_LICENSE 8 56 #define ARG_LICENSE 8
57 #define ARG_MAILBOX_TYPE 9
57 58
58 static struct argp_option mu_common_argp_options[] = 59 static struct argp_option mu_common_argp_options[] =
59 { 60 {
...@@ -73,6 +74,8 @@ static struct argp_option mu_license_argp_option[] = { ...@@ -73,6 +74,8 @@ static struct argp_option mu_license_argp_option[] = {
73 static struct argp_option mu_mailbox_argp_option[] = { 74 static struct argp_option mu_mailbox_argp_option[] = {
74 {"mail-spool", 'm', N_("URL"), 0, 75 {"mail-spool", 'm', N_("URL"), 0,
75 N_("Use specified URL as a mailspool directory"), 0}, 76 N_("Use specified URL as a mailspool directory"), 0},
77 {"mailbox-type", ARG_MAILBOX_TYPE, N_("PROTO"), 0,
78 N_("Default mailbox type to use"), 0 },
76 {"lock-flags", ARG_LOCK_FLAGS, N_("FLAGS"), 0, 79 {"lock-flags", ARG_LOCK_FLAGS, N_("FLAGS"), 0,
77 N_("Default locker flags (E=external, R=retry, T=time, P=pid)"), 0}, 80 N_("Default locker flags (E=external, R=retry, T=time, P=pid)"), 0},
78 {"lock-retry-timeout", ARG_LOCK_RETRY_TIMEOUT, N_("SECONDS"), 0, 81 {"lock-retry-timeout", ARG_LOCK_RETRY_TIMEOUT, N_("SECONDS"), 0,
...@@ -403,6 +406,11 @@ mu_common_argp_parser (int key, char *arg, struct argp_state *state) ...@@ -403,6 +406,11 @@ mu_common_argp_parser (int key, char *arg, struct argp_state *state)
403 mu_strerror (err)); 406 mu_strerror (err));
404 break; 407 break;
405 408
409 case ARG_MAILBOX_TYPE:
410 if (mu_mailbox_set_default_proto (arg))
411 argp_error (state, _("Invalid mailbox type: %s"), arg);
412 break;
413
406 case ARG_LOCK_FLAGS: 414 case ARG_LOCK_FLAGS:
407 { 415 {
408 int flags = 0; 416 int flags = 0;
...@@ -672,7 +680,7 @@ read_rc (const char *progname, const char *name, const char *capa[], ...@@ -672,7 +680,7 @@ read_rc (const char *progname, const char *name, const char *capa[],
672 } 680 }
673 681
674 for (i = 0; i < n_argc; i++) 682 for (i = 0; i < n_argc; i++)
675 x_argv[x_argc++] = n_argv[i]; 683 x_argv[x_argc++] = mu_tilde_expansion (n_argv[i], "/", NULL);
676 684
677 free (n_argv); 685 free (n_argv);
678 } 686 }
......