diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-03-10 13:43:22 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-03-10 13:43:22 +0000 |
commit | 18ebe7bb829772d7bf1df49d23a2c9dd53a2afcd (patch) | |
tree | 51b017fdad8d712f2aa4f7a5d505032acc2e9185 /src | |
parent | 9fe06f87591f813fce7f9068f19246c8d933fc6a (diff) | |
download | mailfromd-18ebe7bb829772d7bf1df49d23a2c9dd53a2afcd.tar.gz mailfromd-18ebe7bb829772d7bf1df49d23a2c9dd53a2afcd.tar.bz2 |
* src/mailfromd.h (enum mf_status_code): Add a comma and a count
definition, needed for make check-exceptions in docs.
* src/status.mfi (m4_ifdef): Use OLD_EXCEPTION_CODES instead of
COMPAT_4_3.
* src/main.c: New command line options: -D (--define), and -U
(--undefine).
* mflib/match_dnsbl.mf (match_dnsbl): Use LAZY_MATCH_RBL instead of
COMPAT_4_3.
Throw e_invip if address is invalid.
* mflib/match_rhsbl.mf (match_rhsbl): Use LAZY_MATCH_RBL instead
of COMPAT_4_3.
* doc/mailfromd.texi: Document variable shadowing and new
features.
* doc/Makefile.am (check-exceptions): Update the rule.
* NEWS: Update.
git-svn-id: file:///svnroot/mailfromd/branches/release_4_3_patches@1630 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'src')
-rw-r--r-- | src/mailfromd.h | 4 | ||||
-rw-r--r-- | src/main.c | 65 | ||||
-rw-r--r-- | src/status.mfi | 2 |
3 files changed, 66 insertions, 5 deletions
diff --git a/src/mailfromd.h b/src/mailfromd.h index d3531f5c..4a124492 100644 --- a/src/mailfromd.h +++ b/src/mailfromd.h @@ -79,7 +79,9 @@ typedef enum mf_status_code { mf_success, mf_not_found, mf_failure, - mf_temp_failure + mf_temp_failure, + + mf_status_count } mf_status; #define mf_resolved(c) ((c) == mf_success || (c) == mf_not_found) @@ -71,6 +71,7 @@ int preprocess_option; /* Only preprocess the sources */ # define DEF_EXT_PP NULL #endif char *ext_pp = DEF_EXT_PP; /* External preprocessor to use */ +char *ext_pp_options; int do_transcript; /* Enable session transript */ int do_trace; /* Enable tracing configuration */ @@ -130,6 +131,50 @@ time_t io_timeout = 3; time_t response_timeout = 30; +/* Preprocessor helper function */ +static void +add_pp_option(const char *opt, const char *arg) +{ + size_t len; + + len = 1 + strlen(opt) + (arg ? strlen(arg) : 0); + if (ext_pp_options) { + len += strlen(ext_pp_options); + ext_pp_options = xrealloc(ext_pp_options, len + 1); + } else { + ext_pp_options = xmalloc(len + 1); + } + strcat(ext_pp_options, " "); + strcat(ext_pp_options, opt); + strcat(ext_pp_options, arg); +} + +static void +alloc_ext_pp() +{ + if (ext_pp_options) { + size_t len; + char *p; + + if (!ext_pp) { + if (!DEF_EXT_PP) { + mu_error(_("Default preprocessor is not set; " + "use --preprocessor option")); + exit(EX_USAGE); + } + ext_pp = DEF_EXT_PP; + } + + len = strlen(ext_pp) + strlen(ext_pp_options); + p = xmalloc(len + 1); + strcpy(p, ext_pp); + strcat(p, ext_pp_options); + ext_pp = p; + } +} + + + /* Logging & debugging */ int @@ -1034,11 +1079,21 @@ static struct argp_option options[] = { N_("Assign VALUE to VAR"), GRP+1 }, { "relayed-domain-file", OPTION_DOMAIN_FILE, N_("FILE"), 0, N_("Read relayed domains from FILE"), GRP+1 }, + +#undef GRP +#define GRP 25 + { NULL, 0, NULL, 0, + N_("Preprocessor options"), GRP }, { "preprocessor", OPTION_PREPROCESSOR, N_("COMMAND"), 0, N_("Use command as external preprocessor"), GRP+1 }, { "no-preprocessor", OPTION_NO_PREPROCESSOR, NULL, 0, N_("Disable the use of external preprocessor"), GRP+1 }, -#undef GRP + { "define", 'D', N_("NAME[=VALUE]"), 0, + N_("Define a preprocessor symbol NAME as having VALUE, or empty"), + GRP+1 }, + { "undefine", 'U', N_("NAME"), 0, + N_("Undefine a preprocessor symbol NAME"), + GRP+1 }, #undef GRP #define GRP 30 @@ -1096,7 +1151,6 @@ static struct argp_option options[] = { #undef GRP /*DEPRECATED OPTIONS*/ - { "domain", 'D', N_("STRING"), OPTION_HIDDEN, "", 1 }, { "ehlo", 0, NULL, OPTION_ALIAS|OPTION_HIDDEN, NULL, 1 }, { "postmaster-email", OPTION_POSTMASTER_EMAIL, N_("EMAIL"), OPTION_HIDDEN, "", 1 }, @@ -1131,9 +1185,12 @@ parse_opt (int key, char *arg, struct argp_state *state) { switch (key) { case 'D': - set_option("ehlo", arg, 1); + add_pp_option("-D", arg); break; + case 'U': + add_pp_option("-U", arg); + case 'd': set_option("debug", arg, 1); break; @@ -2135,6 +2192,8 @@ main(int argc, char **argv) if (rc) exit (EX_CONFIG); + alloc_ext_pp(); + log_setup(log_to_stderr); argv += index; diff --git a/src/status.mfi b/src/status.mfi index 9d69096c..c465522c 100644 --- a/src/status.mfi +++ b/src/status.mfi @@ -17,7 +17,7 @@ const failure e_failure const temp_failure e_temp_failure # Backward-compatible definitions -m4_ifdef(`COMPAT_4_3',` +m4_ifdef(`OLD_EXCEPTION_CODES',` const ston_conv e_ston_conv const divzero e_divzero const regcomp e_regcomp |