1 /*
2 Copyright (C) 1999-2004 IC & S dbmail@ic-s.nl
3 Copyright (c) 2004-2012 NFG Net Facilities Group BV support@nfg.nl
4 Copyright (C) 2006 Aaron Stone aaron@serendipity.cx
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later
10 version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 /*
23 *
24 * imapd.c
25 *
26 * main prg for imap daemon
27 */
28
29 #include "dbmail.h"
30 #define THIS_MODULE "imapd"
31 #define PNAME "dbmail/imap4d"
32
33 extern int imap_before_smtp;
34
main(int argc,char * argv[])35 int main(int argc, char *argv[])
36 {
37 ServerConfig_T config;
38 int result;
39 openlog(PNAME, LOG_PID, LOG_MAIL);
40 memset(&config, 0, sizeof(ServerConfig_T));
41 result = server_getopt(&config, "IMAP", argc, argv);
42 if (result == -1) goto shutdown;
43 if (result == 1) {
44 server_showhelp("dbmail-imapd",
45 "This daemon provides Internet "
46 "Message Access Protocol 4.1 "
47 "services.");
48 goto shutdown;
49 }
50
51 config.ClientHandler = imap_handle_connection;
52 imap_before_smtp = config.service_before_smtp;
53 result = server_mainloop(&config, "dbmail-imapd");
54 shutdown:
55 TRACE(TRACE_INFO, "return [%d]", result);
56 return result;
57 }
58
59