main.c revision c9666590922a85fa21b80608402448215e71fc10
/* Copyright (C) 2002 Timo Sirainen */
#include "common.h"
#include "ioloop.h"
#include "ostream.h"
#include "lib-signals.h"
#include "rawlog.h"
#include "restrict-access.h"
#include "fd-close-on-exec.h"
#include "process-title.h"
#include "module-dir.h"
#include "mail-storage.h"
#include "commands.h"
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#define IS_STANDALONE() \
unsigned int max_custom_flag_length, mailbox_check_interval;
{
}
static void open_logfile(void)
{
const char *user;
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();
}
static void main_init(void)
{
struct mail_storage *storage;
if (IS_STANDALONE())
i_fatal("USER environment missing");
}
clients_init();
/* support also maildir-specific environment */
}
/* failed */
else {
const char *home;
i_fatal("MAIL environment missing and "
"autodetection failed (home %s)", home);
}
}
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();
}
{
#ifdef DEBUG
#endif
/* NOTE: we start rooted, so keep the code minimal until
restrict_access_by_env() is called */
lib_init();
main_init();
main_deinit();
lib_deinit();
return 0;
}