Commit 057471f6 057471f6debcf726ac515f029e71bf8af819a671 by Sergey Poznyakoff

Use "tls" command line capability.

1 parent c255ceba
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
39 #include <mailutils/stream.h> 39 #include <mailutils/stream.h>
40 #include <mailutils/url.h> 40 #include <mailutils/url.h>
41 #include <mailutils/nls.h> 41 #include <mailutils/nls.h>
42 #include <mailutils/tls.h>
42 43
43 static char* show_field; 44 static char* show_field;
44 static int show_to; 45 static int show_to;
...@@ -161,6 +162,9 @@ static const char *frm_argp_capa[] = { ...@@ -161,6 +162,9 @@ static const char *frm_argp_capa[] = {
161 "common", 162 "common",
162 "license", 163 "license",
163 "mailbox", 164 "mailbox",
165 #ifdef WITH_TLS
166 "tls",
167 #endif
164 NULL 168 NULL
165 }; 169 };
166 170
...@@ -308,6 +312,9 @@ main(int argc, char **argv) ...@@ -308,6 +312,9 @@ main(int argc, char **argv)
308 mu_init_nls (); 312 mu_init_nls ();
309 313
310 mu_argp_init (program_version, NULL); 314 mu_argp_init (program_version, NULL);
315 #ifdef WITH_TLS
316 mu_tls_init_client_argp ();
317 #endif
311 mu_argp_parse (&argp, &argc, &argv, 0, frm_argp_capa, &c, NULL); 318 mu_argp_parse (&argp, &argc, &argv, 0, frm_argp_capa, &c, NULL);
312 319
313 /* have an argument */ 320 /* have an argument */
...@@ -323,6 +330,7 @@ main(int argc, char **argv) ...@@ -323,6 +330,7 @@ main(int argc, char **argv)
323 registrar_get_list (&bookie); 330 registrar_get_list (&bookie);
324 list_append (bookie, mbox_record); 331 list_append (bookie, mbox_record);
325 list_append (bookie, path_record); 332 list_append (bookie, path_record);
333 list_append (bookie, mh_record);
326 list_append (bookie, pop_record); 334 list_append (bookie, pop_record);
327 list_append (bookie, imap_record); 335 list_append (bookie, imap_record);
328 } 336 }
......
...@@ -82,6 +82,9 @@ static const char *capa[] = { ...@@ -82,6 +82,9 @@ static const char *capa[] = {
82 "common", 82 "common",
83 "license", 83 "license",
84 "mailbox", 84 "mailbox",
85 #ifdef WITH_TLS
86 "tls",
87 #endif
85 NULL 88 NULL
86 }; 89 };
87 90
...@@ -104,6 +107,9 @@ main(int argc, char **argv) ...@@ -104,6 +107,9 @@ main(int argc, char **argv)
104 { 107 {
105 int opt; 108 int opt;
106 mu_argp_init (program_version, NULL); 109 mu_argp_init (program_version, NULL);
110 #ifdef WITH_TLS
111 mu_tls_init_client_argp ();
112 #endif
107 mu_argp_parse (&argp, &argc, &argv, 0, capa, &opt, NULL); 113 mu_argp_parse (&argp, &argc, &argv, 0, capa, &opt, NULL);
108 mailbox_name = argv[opt]; 114 mailbox_name = argv[opt];
109 } 115 }
...@@ -114,6 +120,7 @@ main(int argc, char **argv) ...@@ -114,6 +120,7 @@ main(int argc, char **argv)
114 registrar_get_list (&bookie); 120 registrar_get_list (&bookie);
115 list_append (bookie, mbox_record); 121 list_append (bookie, mbox_record);
116 list_append (bookie, path_record); 122 list_append (bookie, path_record);
123 list_append (bookie, mh_record);
117 list_append (bookie, pop_record); 124 list_append (bookie, pop_record);
118 list_append (bookie, imap_record); 125 list_append (bookie, imap_record);
119 } 126 }
......
...@@ -136,10 +136,6 @@ parse_opt (int key, char *arg, struct argp_state *state) ...@@ -136,10 +136,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
136 136
137 if (args->file) 137 if (args->file)
138 { 138 {
139 util_error (_("Usage error: --file takes an optional argument, "
140 "it must follow the option\n"
141 "without any intervening whitespace."));
142 util_error (_("Run mail --help for more info."));
143 args->file = arg; 139 args->file = arg;
144 } 140 }
145 else 141 else
...@@ -171,6 +167,9 @@ static const char *mail_capa[] = { ...@@ -171,6 +167,9 @@ static const char *mail_capa[] = {
171 "common", 167 "common",
172 "license", 168 "license",
173 "mailbox", 169 "mailbox",
170 #ifdef WITH_TLS
171 "tls",
172 #endif
174 NULL 173 NULL
175 }; 174 };
176 175
...@@ -222,7 +221,7 @@ main (int argc, char **argv) ...@@ -222,7 +221,7 @@ main (int argc, char **argv)
222 /* Native Language Support */ 221 /* Native Language Support */
223 mu_init_nls (); 222 mu_init_nls ();
224 223
225 /* Register the desire formats. */ 224 /* Register the desired formats. */
226 { 225 {
227 list_t bookie; 226 list_t bookie;
228 registrar_get_list (&bookie); 227 registrar_get_list (&bookie);
...@@ -252,7 +251,7 @@ main (int argc, char **argv) ...@@ -252,7 +251,7 @@ main (int argc, char **argv)
252 /* set up the default environment */ 251 /* set up the default environment */
253 if (!getenv ("HOME")) 252 if (!getenv ("HOME"))
254 { 253 {
255 char *p = util_get_homedir(); 254 char *p = util_get_homedir ();
256 setenv ("HOME", p, 0); 255 setenv ("HOME", p, 0);
257 } 256 }
258 setenv ("DEAD", util_fullpath("~/dead.letter"), 0); 257 setenv ("DEAD", util_fullpath("~/dead.letter"), 0);
...@@ -326,6 +325,9 @@ main (int argc, char **argv) ...@@ -326,6 +325,9 @@ main (int argc, char **argv)
326 /* argument parsing */ 325 /* argument parsing */
327 326
328 mu_argp_init (program_version, NULL); 327 mu_argp_init (program_version, NULL);
328 #ifdef WITH_TLS
329 mu_tls_init_client_argp ();
330 #endif
329 mu_argp_parse (&argp, &argc, &argv, 0, mail_capa, NULL, &args); 331 mu_argp_parse (&argp, &argc, &argv, 0, mail_capa, NULL, &args);
330 332
331 /* read system-wide mail.rc and user's .mailrc */ 333 /* read system-wide mail.rc and user's .mailrc */
......
...@@ -45,6 +45,9 @@ static const char *argp_capa[] = { ...@@ -45,6 +45,9 @@ static const char *argp_capa[] = {
45 "common", 45 "common",
46 "license", 46 "license",
47 "mailbox", 47 "mailbox",
48 #ifdef WITH_TLS
49 "tls",
50 #endif
48 NULL 51 NULL
49 }; 52 };
50 53
...@@ -101,6 +104,9 @@ main (int argc, char **argv) ...@@ -101,6 +104,9 @@ main (int argc, char **argv)
101 mu_init_nls (); 104 mu_init_nls ();
102 105
103 mu_argp_init (program_version, NULL); 106 mu_argp_init (program_version, NULL);
107 #ifdef WITH_TLS
108 mu_tls_init_client_argp ();
109 #endif
104 mu_argp_parse (&argp, &argc, &argv, 0, argp_capa, NULL, &args); 110 mu_argp_parse (&argp, &argc, &argv, 0, argp_capa, NULL, &args);
105 111
106 registrar_get_list (&bookie); 112 registrar_get_list (&bookie);
......
...@@ -59,6 +59,9 @@ static struct argp argp = { ...@@ -59,6 +59,9 @@ static struct argp argp = {
59 static const char *readmsg_argp_capa[] = { 59 static const char *readmsg_argp_capa[] = {
60 "common", 60 "common",
61 "mailbox", 61 "mailbox",
62 #ifdef WITH_TLS
63 "tls",
64 #endif
62 NULL 65 NULL
63 }; 66 };
64 67
...@@ -229,6 +232,9 @@ main (int argc, char **argv) ...@@ -229,6 +232,9 @@ main (int argc, char **argv)
229 mu_init_nls (); 232 mu_init_nls ();
230 233
231 mu_argp_init (program_version, NULL); 234 mu_argp_init (program_version, NULL);
235 #ifdef WITH_TLS
236 mu_tls_init_client_argp ();
237 #endif
232 mu_argp_parse (&argp, &argc, &argv, 0, readmsg_argp_capa, &index, NULL); 238 mu_argp_parse (&argp, &argc, &argv, 0, readmsg_argp_capa, &index, NULL);
233 239
234 /* Registration. */ 240 /* Registration. */
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
42 #include <mailutils/registrar.h> 42 #include <mailutils/registrar.h>
43 #include <mailutils/stream.h> 43 #include <mailutils/stream.h>
44 #include <mailutils/nls.h> 44 #include <mailutils/nls.h>
45 #include <mailutils/tls.h>
45 46
46 void mutil_register_all_mbox_formats (void); 47 void mutil_register_all_mbox_formats (void);
47 48
...@@ -221,6 +222,9 @@ static const char *sieve_argp_capa[] = ...@@ -221,6 +222,9 @@ static const char *sieve_argp_capa[] =
221 "logging", 222 "logging",
222 "mailer", 223 "mailer",
223 "sieve", 224 "sieve",
225 #ifdef WITH_TLS
226 "tls",
227 #endif
224 NULL 228 NULL
225 }; 229 };
226 230
...@@ -311,6 +315,9 @@ main (int argc, char *argv[]) ...@@ -311,6 +315,9 @@ main (int argc, char *argv[])
311 mu_init_nls (); 315 mu_init_nls ();
312 316
313 mu_argp_init (program_version, NULL); 317 mu_argp_init (program_version, NULL);
318 #ifdef WITH_TLS
319 mu_tls_init_client_argp ();
320 #endif
314 sieve_argp_init (); 321 sieve_argp_init ();
315 rc = mu_argp_parse (&argp, &argc, &argv, ARGP_IN_ORDER, sieve_argp_capa, 322 rc = mu_argp_parse (&argp, &argc, &argv, ARGP_IN_ORDER, sieve_argp_capa,
316 0, &opts); 323 0, &opts);
......