1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#define XERR
#include "main.ih"
namespace
{
ArgConfig::LongOption longOpts[] =
{
ArgConfig::LongOption{ "accept", ArgConfig::Required },
ArgConfig::LongOption{ "cls", ArgConfig::Required },
ArgConfig::LongOption{ "config", 'c' },
ArgConfig::LongOption{ "expire", 'e' },
ArgConfig::LongOption{ "help", 'h' },
ArgConfig::LongOption{ "ignore", ArgConfig::Required },
ArgConfig::LongOption{ "interactive", 'i' },
ArgConfig::LongOption{ "IP4-pattern", 'p' },
ArgConfig::LongOption{ "log", 'l' },
ArgConfig::LongOption{ "preamble", ArgConfig::NoArg },
ArgConfig::LongOption{ "received", 'R'},
ArgConfig::LongOption{ "rules", 'r' },
ArgConfig::LongOption{ "spam", ArgConfig::Required },
ArgConfig::LongOption{ "syntax", ArgConfig::NoArg },
ArgConfig::LongOption{ "version", 'v' },
};
}
int main(int argc, char **argv)
try
{
Options::initialize(
usage, Icmbuild::version,
ArgConfig::initialize(
"c:e:hiIl:p:r:R:v", longOpts, end(longOpts), argc, argv
)
);
if (ArgConfig::instance().option('I'))
{
Inspector{}.run();
return 0;
}
preamble(); // static data initializations
if (Expire{}.check())
return 0;
Filter filter; // otherwise: filter the incoming mail
inspect(filter); // inspect the mail, set the filter action
filter.done(); // accept if no action so far
}
catch (...)
{
return handleException();
}
|