From d6e20136b71dc5f3cd333a6342223f814ec2e7a2 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Tue, 13 Aug 2024 11:33:54 +0100 Subject: [PATCH] static strings for routers-supported -bV --- src/src/drtables.c | 93 ++++++++++++++++++++++------------------------ test/runtest | 7 ++-- 2 files changed, 49 insertions(+), 51 deletions(-) diff --git a/src/src/drtables.c b/src/src/drtables.c index 987846bac..9225fafe1 100644 --- a/src/src/drtables.c +++ b/src/src/drtables.c @@ -500,70 +500,67 @@ return string_cat(g, US"\n"); gstring * route_show_supported(gstring * g) { -gstring * b = NULL, * d = NULL; - #ifdef old g = string_cat(g, US"Routers:"); /*XXX these run off the static list as we want them before the conf is read */ /*XXX lookup_show_supported is in exim.c and just works off the #defines, with hardoded strings */ for (router_info * rr = routers_available_oldarray; rr->drinfo.driver_name[0]; rr++) g = string_fmt_append(g, " %s", rr->drinfo.driver_name); +return string_cat(g, US"\n"); #else -#ifdef ROUTER_ACCEPT -# if ROUTER_ACCEPT!=2 - b = string_cat(b, US" accept"); -# else - d = string_cat(d, US" cdb"); -# endif +uschar * b = US"" /* static-build router names */ +#if defined(ROUTER_ACCEPT) && ROUTER_ACCEPT!=2 + " accept" #endif -#ifdef ROUTER_DNSLOOKUP -# if ROUTER_DNSLOOKUP!=2 - b = string_cat(g, US" dnslookup"); -# else - d = string_cat(g, US" dnslookup"); -# endif -#endif -# ifdef ROUTER_IPLITERAL -# if ROUTER_IPLITERAL!=2 - b = string_cat(g, US" ipliteral"); -# else - d = string_cat(g, US" ipliteral"); -# endif +#if defined(ROUTER_DNSLOOKUP) && ROUTER_DNSLOOKUP!=2 + " dnslookup" #endif -#ifdef ROUTER_IPLOOKUP -# if ROUTER_IPLOOKUP!=2 - b = string_cat(g, US" iplookup"); -# else - d = string_cat(g, US" iplookup"); -# endif +# if defined(ROUTER_IPLITERAL) && ROUTER_IPLITERAL!=2 + " ipliteral" #endif -#ifdef ROUTER_MANUALROUTE -# if ROUTER_MANUALROUTE!=2 - b = string_cat(g, US" manualroute"); -# else - d = string_cat(g, US" manualroute"); -# endif +#if defined(ROUTER_IPLOOKUP) && ROUTER_IPLOOKUP!=2 + " iplookup" #endif -#ifdef ROUTER_REDIRECT -# if ROUTER_REDIRECT!=2 - b = string_cat(g, US" redirect"); -# else - d = string_cat(g, US" redirect"); -# endif +#if defined(ROUTER_MANUALROUTE) && ROUTER_MANUALROUTE!=2 + " manualroute" #endif -#ifdef ROUTER_QUERYPROGRAM -# if ROUTER_QUERYPROGRAM!=2 - b = string_cat(g, US" queryprogram"); -# else - d = string_cat(g, US" queryprogram"); -# endif +#if defined(ROUTER_REDIRECT) && ROUTER_REDIRECT!=2 + " redirect" +#endif +#if defined(ROUTER_QUERYPROGRAM) && ROUTER_QUERYPROGRAM!=2 + " queryprogram" #endif + ; -if (b) g = string_fmt_append(g, "Routers (built-in):%Y\n", b); -if (d) g = string_fmt_append(g, "Routers (dynamic): %Y\n", d); +uschar * d = US"" /* dynamic-module router names */ +#if defined(ROUTER_ACCEPT) && ROUTER_ACCEPT==2 + " accept" #endif -return string_cat(g, US"\n"); +#if defined(ROUTER_DNSLOOKUP) && ROUTER_DNSLOOKUP==2 + " dnslookup" +#endif +# if defined(ROUTER_IPLITERAL) && ROUTER_IPLITERAL==2 + " ipliteral" +#endif +#if defined(ROUTER_IPLOOKUP) && ROUTER_IPLOOKUP==2 + " iplookup" +#endif +#if defined(ROUTER_MANUALROUTE) && ROUTER_MANUALROUTE==2 + " manualroute" +#endif +#if defined(ROUTER_REDIRECT) && ROUTER_REDIRECT==2 + " redirect" +#endif +#if defined(ROUTER_QUERYPROGRAM) && ROUTER_QUERYPROGRAM==2 + " queryprogram" +#endif + ; + +if (*b) g = string_fmt_append(g, "Routers (built-in):%s\n", b); +if (*d) g = string_fmt_append(g, "Routers (dynamic): %s\n", d); +return g; +#endif /*!old*/ } gstring * diff --git a/test/runtest b/test/runtest index d73bc393e..1d7589a69 100755 --- a/test/runtest +++ b/test/runtest @@ -1163,7 +1163,7 @@ RESET_AFTER_EXTRA_LINE_READ: | Authenticators: | Lookups(?:\(built-in\))?: | Support\ for: - | Routers: + | Routers\ \((?:built-in|dynamic)\): | Transports: | Malware: | log\ selectors\ = @@ -3745,12 +3745,13 @@ while () %parm_authenticators = @temp; } - elsif (/^Routers: (.*)/) + elsif (/^Routers \((?:built-in|dynamic)\): ?(.*)/) { print; @temp = split /(\s+)/, $1; push(@temp, ' '); - %parm_routers = @temp; + my %temp_routers= @temp; + @parm_routers{keys %temp_routers} = values %temp_routers; } # Some transports have options, e.g. appendfile/maildir. For those, ensure -- 2.30.2