1 /* GNU Mailutils -- a suite of utilities for electronic mail
2    Copyright (C) 2007-2021 Free Software Foundation, Inc.
3 
4    GNU Mailutils is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 3, or (at your option)
7    any later version.
8 
9    GNU Mailutils is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13 
14    You should have received a copy of the GNU General Public License
15    along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>. */
16 
17 #include "libmda.h"
18 
19 static char *capa[] = {
20   "auth",
21   "debug",
22   "mailbox",
23   "locking",
24   "mailer",
25   "sieve",
26   "deliver",
27   "script",
28   NULL
29 };
30 
31 struct mu_cli_setup cli = {
32   NULL,
33   NULL,
34   N_("putmail -- incorporates mail to a mailbox."),
35   N_("[URL...]"),
36 };
37 
38 int
main(int argc,char ** argv)39 main (int argc, char **argv)
40 {
41   umask (0077);
42 
43   /* Native Language Support */
44   MU_APP_INIT_NLS ();
45 
46   /* Default locker settings */
47   mu_locker_defaults.flags = MU_LOCKER_FLAG_CHECK_PID | MU_LOCKER_FLAG_RETRY;
48   mu_locker_defaults.retry_sleep = 1;
49   mu_locker_defaults.retry_count = 300;
50 
51   /* Register needed modules */
52   MU_AUTH_REGISTER_ALL_MODULES ();
53 
54   /* Register all supported mailbox and mailer formats */
55   mu_register_all_formats ();
56   mu_registrar_record (mu_smtp_record);
57 
58   mda_filter_cfg_init ();
59 
60   mu_log_syslog = 0;
61   mu_log_print_severity = 1;
62 
63   /* Parse command line */
64   mda_cli_capa_init ();
65   mu_cli (argc, argv, &cli, capa, NULL, &argc, &argv);
66   if (argc == 0)
67     {
68       mu_error (_("recipients not given"));
69       return EX_USAGE;
70     }
71 
72   return mda_run_delivery (mda_deliver_to_url, argc, argv);
73 }
74 
75 
76