main.c revision 95d493c371891ea3b7598926d6b5464eabe27860
/* Copyright (C) 2002-2003 Timo Sirainen */
#include "common.h"
#include "ioloop.h"
#include "ostream.h"
#include "str.h"
#include "lib-signals.h"
#include "restrict-access.h"
#include "fd-close-on-exec.h"
#include "process-title.h"
#include "randgen.h"
#include "module-dir.h"
#include "mail-storage.h"
#include "commands.h"
#include "namespace.h"
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#define IS_STANDALONE() \
struct client_workaround_list {
const char *name;
enum client_workarounds num;
};
struct client_workaround_list client_workaround_list[] = {
{ "oe6-fetch-no-newmail", WORKAROUND_OE6_FETCH_NO_NEWMAIL },
{ "outlook-idle", WORKAROUND_OUTLOOK_IDLE },
{ "netscape-eoh", WORKAROUND_NETSCAPE_EOH },
{ NULL, 0 }
};
unsigned int max_keyword_length, mailbox_check_interval;
unsigned int imap_max_line_length;
enum client_workarounds client_workarounds = 0;
static pool_t namespace_pool;
{
}
static void parse_workarounds(void)
{
struct client_workaround_list *list;
return;
break;
}
}
}
}
static void open_logfile(void)
{
const char *user;
return;
}
if (IS_STANDALONE())
user = "??";
}
/* quite a long user name, cut it */
}
else {
/* log to file or stderr */
}
}
static void drop_privileges(void)
{
/* Log file or syslog opening probably requires roots */
open_logfile();
chrooting. */
random_init();
}
static void main_init(void)
{
if (IS_STANDALONE())
i_fatal("USER environment missing");
}
clients_init();
if (IS_STANDALONE()) {
/* Support for mailfront */
" OK Logged in.", NULL));
}
}
static void main_deinit(void)
{
/* warn about being killed because of some signal, except SIGINT (^C)
which is too common at least while testing :) */
closelog();
}
#include "ostream.h"
#include "ostream-crlf.h"
#include <fcntl.h>
{
#ifdef DEBUG
#endif
/* NOTE: we start rooted, so keep the code minimal until
restrict_access_by_env() is called */
lib_init();
{ struct ostream *stream = o_stream_create_lf(default_pool, o_stream_create_file(open("/tmp/foo", O_CREAT|O_TRUNC|O_WRONLY, 0600), default_pool, 0, 0));
}
main_init();
main_deinit();
lib_deinit();
return 0;
}