From 383832efc13b2027e89426a952430158028a3b0f Mon Sep 17 00:00:00 2001 From: "Heiko Schlittermann (HS12-RIPE)" Date: Sun, 4 Dec 2016 18:40:21 +0100 Subject: [PATCH] Use long names for the _DRIVER_*, and _OPT_* macros --- doc/doc-docbook/spec.xfpt | 16 +++++++---- doc/doc-txt/NewStuff | 2 +- src/src/functions.h | 2 +- src/src/readconf.c | 57 ++++++++++++++++++++------------------- src/src/route.c | 6 ++--- src/src/transport.c | 8 +++--- 6 files changed, 50 insertions(+), 41 deletions(-) diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index fb0b6e550..805e1dfa4 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -5043,11 +5043,17 @@ They can be used to conditionally include parts of a configuration The following classes of macros are defined: .display -&` _HAVE_ `& build-time defines -&` _DRVR_AUTH_ `& authenticator drivers -&` _DRVR_RTR_ `& router drivers -&` _DRVR_TPT_ `& transport drivers -&` _OPT_ `& configuration option support +&` _HAVE_* `& build-time defines +&` _DRIVER_ROUTER_* `& router drivers +&` _DRIVER_TRANSPORT_* `& transport drivers +&` _DRIVER_AUTHENTICATOR_* `& authenticator drivers +&` _OPT_MAIN_* `& main config options +&` _OPT_ROUTERS_* `& generic router options +&` _OPT_TRANSPORTS_* `& generic transport options +&` _OPT_AUTHENTICATORS_* `& generic authenticator options +&` _OPT_ROUTER_*_* `& private router options +&` _OPT_TRANSPORT_*_* `& private transport options +&` _OPT_AUTHENTICATOR_*_* `& private authenticator options .endd Use an &"exim -bP macros"& command to get the list of macros. diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 013004bb9..ee9589801 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -39,7 +39,7 @@ Version 4.88 10. Feature macros, generated from compile options. All start with "_HAVE_" and go on with some roughly recognisable name. Driver macros, for - router, transport and authentication drivers; names starting with "_DRVR_". + router, transport and authentication drivers; names starting with "_DRIVER_". Option macros, for each configuration-file option; all start with "_OPT_". Use the "-bP macros" command-line option to see what is present. diff --git a/src/src/functions.h b/src/src/functions.h index cc4e22b2e..04d941034 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -317,7 +317,7 @@ extern void readconf_driver_init(uschar *, driver_instance **, driver_info *, int, void *, int, optionlist *, int); extern uschar *readconf_find_option(void *); extern void readconf_main(BOOL); -extern void readconf_options_from_list(optionlist *, unsigned, uschar *); +extern void readconf_options_from_list(optionlist *, unsigned, const uschar *, uschar *); extern void readconf_options_routers(void); extern void readconf_options_transports(void); extern void readconf_print(uschar *, uschar *, BOOL); diff --git a/src/src/readconf.c b/src/src/readconf.c index 27a834b3f..b2a3c7370 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -793,76 +793,76 @@ due to conflicts with other common macros. */ #endif #ifdef LOOKUP_LSEARCH - macro_create(US"_HAVE_LKUP_LSEARCH", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_LSEARCH", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_CDB - macro_create(US"_HAVE_LKUP_CDB", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_CDB", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_DBM - macro_create(US"_HAVE_LKUP_DBM", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_DBM", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_DNSDB - macro_create(US"_HAVE_LKUP_DNSDB", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_DNSDB", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_DSEARCH - macro_create(US"_HAVE_LKUP_DSEARCH", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_DSEARCH", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_IBASE - macro_create(US"_HAVE_LKUP_IBASE", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_IBASE", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_LDAP - macro_create(US"_HAVE_LKUP_LDAP", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_LDAP", US"y", FALSE, TRUE); #endif #ifdef EXPERIMENTAL_LMDB - macro_create(US"_HAVE_LKUP_LMDB", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_LMDB", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_MYSQL - macro_create(US"_HAVE_LKUP_MYSQL", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_MYSQL", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_NIS - macro_create(US"_HAVE_LKUP_NIS", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_NIS", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_NISPLUS - macro_create(US"_HAVE_LKUP_NISPLUS", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_NISPLUS", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_ORACLE - macro_create(US"_HAVE_LKUP_ORACLE", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_ORACLE", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_PASSWD - macro_create(US"_HAVE_LKUP_PASSWD", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_PASSWD", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_PGSQL - macro_create(US"_HAVE_LKUP_PGSQL", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_PGSQL", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_REDIS - macro_create(US"_HAVE_LKUP_REDIS", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_REDIS", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_SQLITE - macro_create(US"_HAVE_LKUP_SQLITE", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_SQLITE", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_TESTDB - macro_create(US"_HAVE_LKUP_TESTDB", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_TESTDB", US"y", FALSE, TRUE); #endif #ifdef LOOKUP_WHOSON - macro_create(US"_HAVE_LKUP_WHOSON", US"y", FALSE, TRUE); + macro_create(US"_HAVE_LOOKUP_WHOSON", US"y", FALSE, TRUE); #endif #ifdef TRANSPORT_APPENDFILE # ifdef SUPPORT_MAILDIR - macro_create(US"_HAVE_TPT_APPEND_MAILDR", US"y", FALSE, TRUE); + macro_create(US"_HAVE_TRANSPORT_APPEND_MAILDR", US"y", FALSE, TRUE); # endif # ifdef SUPPORT_MAILSTORE - macro_create(US"_HAVE_TPT_APPEND_MAILSTORE", US"y", FALSE, TRUE); + macro_create(US"_HAVE_TRANSPORT_APPEND_MAILSTORE", US"y", FALSE, TRUE); # endif # ifdef SUPPORT_MBX - macro_create(US"_HAVE_TPT_APPEND_MBX", US"y", FALSE, TRUE); + macro_create(US"_HAVE_TRANSPORT_APPEND_MBX", US"y", FALSE, TRUE); # endif #endif } void -readconf_options_from_list(optionlist * opts, unsigned nopt, uschar * group) +readconf_options_from_list(optionlist * opts, unsigned nopt, const uschar * section, uschar * group) { int i; const uschar * s; @@ -875,14 +875,17 @@ macros that have substrings are always discovered first during expansion. */ for (i = 0; i < nopt; i++) if (*(s = opts[i].name) && *s != '*') - macro_create(string_sprintf("_OPT_%T_%T", group, s), US"y", FALSE, TRUE); + if (group) + macro_create(string_sprintf("_OPT_%T_%T_%T", section, group, s), US"y", FALSE, TRUE); + else + macro_create(string_sprintf("_OPT_%T_%T", section, s), US"y", FALSE, TRUE); } static void readconf_options(void) { -readconf_options_from_list(optionlist_config, nelem(optionlist_config), US"MAIN"); +readconf_options_from_list(optionlist_config, nelem(optionlist_config), US"MAIN", NULL); readconf_options_routers(); readconf_options_transports(); readconf_options_auths(); @@ -4304,12 +4307,12 @@ readconf_options_auths(void) { struct auth_info * ai; -readconf_options_from_list(optionlist_auths, optionlist_auths_size, US"AU"); +readconf_options_from_list(optionlist_auths, optionlist_auths_size, US"AUTHENTICATORS", NULL); for (ai = auths_available; ai->driver_name[0]; ai++) { - macro_create(string_sprintf("_DRVR_AUTH_%T", ai->driver_name), US"y", FALSE, TRUE); - readconf_options_from_list(ai->options, (unsigned)*ai->options_count, ai->driver_name); + macro_create(string_sprintf("_DRIVER_AUTHENTICATOR_%T", ai->driver_name), US"y", FALSE, TRUE); + readconf_options_from_list(ai->options, (unsigned)*ai->options_count, US"AUTHENTICATOR", ai->driver_name); } } diff --git a/src/src/route.c b/src/src/route.c index 3ca1afbfb..bb220c69b 100644 --- a/src/src/route.c +++ b/src/src/route.c @@ -148,12 +148,12 @@ readconf_options_routers(void) { struct router_info * ri; -readconf_options_from_list(optionlist_routers, nelem(optionlist_routers), US"RT"); +readconf_options_from_list(optionlist_routers, nelem(optionlist_routers), US"ROUTERS", NULL); for (ri = routers_available; ri->driver_name[0]; ri++) { - macro_create(string_sprintf("_DRVR_RTR_%T", ri->driver_name), US"y", FALSE, TRUE); - readconf_options_from_list(ri->options, (unsigned)*ri->options_count, ri->driver_name); + macro_create(string_sprintf("_DRIVER_ROUTER_%T", ri->driver_name), US"y", FALSE, TRUE); + readconf_options_from_list(ri->options, (unsigned)*ri->options_count, US"ROUTER", ri->driver_name); } } diff --git a/src/src/transport.c b/src/src/transport.c index 8381913fc..c48f1575b 100644 --- a/src/src/transport.c +++ b/src/src/transport.c @@ -116,14 +116,14 @@ readconf_options_transports(void) { struct transport_info * ti; -readconf_options_from_list(optionlist_transports, nelem(optionlist_transports), US"TP"); +readconf_options_from_list(optionlist_transports, nelem(optionlist_transports), US"TRANSPORTS", NULL); for (ti = transports_available; ti->driver_name[0]; ti++) { - macro_create(string_sprintf("_DRVR_TPT_%T", ti->driver_name), US"y", FALSE, TRUE); - readconf_options_from_list(ti->options, (unsigned)*ti->options_count, ti->driver_name); + macro_create(string_sprintf("_DRIVER_TRANSPORT_%T", ti->driver_name), US"y", FALSE, TRUE); + readconf_options_from_list(ti->options, (unsigned)*ti->options_count, US"TRANSPORT", ti->driver_name); } -} +} /************************************************* * Initialize transport list * -- 2.25.1