base.m4: Nearly set DKIM expiry time.
[exim-config] / defs.m4
diff --git a/defs.m4 b/defs.m4
index 69aa7b7..8beb3b1 100644 (file)
--- a/defs.m4
+++ b/defs.m4
@@ -28,12 +28,12 @@ m4_changecom(<:#:#:>)
 ### Output file preamble and postamble.
 
 m4_divert(0)m4_dnl
-### -*-conf-*- GENERATED FROM /etc/mail/m4/*.m4: DO NOT EDIT!
+### -*-conf-*- GENERATED FROM exim-config/*.m4 (MODE) DO NOT EDIT!
 ###
 ### Exim configuration for distorted.org.uk.
 
 m4_divert(1000)m4_dnl
-### GENERATED FROM exim4.conf.m4: DO NOT EDIT!
+### GENERATED FROM exim-config/*.m4 (MODE): DO NOT EDIT!
 m4_divert(-1)
 
 ###--------------------------------------------------------------------------
@@ -142,6 +142,20 @@ CLRSEP<::>FOREACH(<:SEP(:)$:><:1:>, <:$1:>):>)
 m4_define(<:WARNING_HEADER:>,
 <:add_header = X-CONF_header_token-Warning: $1 $2:>)
 
+## _LOOKUP_ARGS([if-found], [if-not-found], [default])
+##
+## Processing for lookup arguments.  Use as
+##
+##     ${lookup {K} ST {F} _LOOKUP_ARGS(...)}$.
+##
+## IF-FOUND defaults to `{$value}'; IF-NOT-FOUND defaults to DEFAULT, which
+## defaults to `{}'.
+m4_define(<:_LOOKUP_ARGS:>,
+       <:m4_ifelse(<:$1$2$3:>, <::>, <::>,
+                   <:$1$2:>, <::>, <:{$value}$3:>,
+                   <:$2:>, <::>, <:$1$3:>,
+                   <:$1$2:>):>)
+
 ## LOOKUP_DOMAIN(dom, [if-found], [if-not-found])
 ##
 ## Look up DOM in the master domains file.  If it's found, put the
@@ -152,21 +166,20 @@ m4_define(<:WARNING_HEADER:>,
 m4_define(<:LOOKUP_DOMAIN:>,
        <:if exists{CONF_sysconf_dir/domains.conf} \
             {${lookup {$1}partial0-lsearch{CONF_sysconf_dir/domains.conf} \
-                      m4_ifelse(<:$2$3:>, <::>, <::>,
-                                <:$2:>, <::>, <:{$value}$3:>,
-                                <:$2$3:>)}} \
+                      _LOOKUP_ARGS(<:$2:>, <:$3:>)}} \
             $3:>)
 
-## KV(key, result)
+## KV(key, [result])
 ##
 ## Extract the value of the named KEY in the ${extract ...}-style string in
 ## the current $value (where it may have been left by `LOOKUP-DOMAIN').  The
 ## RESULT is a pair {IF-FOUND}{IF-NOT-FOUND}; the former may use $value to
 ## refer to the value; the latter may be `fail' (not in braces) to force
-## expansion failure.
+## expansion failure.  The default is to expand to the extracted value or
+## nothing.
 m4_define(<:KV:>, <:${extract {$1}{$value}$2}:>)
 
-## DOMKV(key, result)
+## DOMKV(key, [result])
 ##
 ## Extract the value of the named KEY in the ${extract ...}-style string in
 ## $domain_data; see `KV'.