chiark / gitweb /
satellite.m4: Apply `/etc/aliases' to master-domain-qualified addresses.
[exim-config] / defs.m4
diff --git a/defs.m4 b/defs.m4
index f9b333301ca0739a78f088c85f41abf2aa1999d5..8beb3b14b6ff384f375dd19e98517e377417817c 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)
 
 ###--------------------------------------------------------------------------
@@ -45,7 +45,7 @@ m4_divert(-1)
 m4_define(<:ONEOF:>, <:m4_ifelse(<:$#:>, <:1:>, <:$1:>,
        <:$1:>, <::>, <:ONEOF(m4_shift($@)):>, <:$1:>):>)
 
-## DEFCONF(CONF, DEFAULT)
+## DEFCONF(conf, default)
 ##
 ## Define config variable CONF, assigning it the DEFAULT value if not
 ## overridden by `SETCONF'.
@@ -53,7 +53,7 @@ m4_define(<:DEFCONF:>,
 <:m4_ifdef(<:CONF_$1:>, <::>,
 <:m4_define(<:CONF_$1:>, <:$2:>):>):>)
 
-## SETCONF(CONF, VALUE)
+## SETCONF(conf, value)
 ##
 ## Set config variable VALUE.
 m4_define(<:SETCONF:>, <:m4_define(<:CONF_$1:>, <:$2:>):>)
@@ -73,10 +73,32 @@ m4_pushdef(<:_foreach_func:>, <:$1:>)m4_dnl
 _FOREACH($2)<::>m4_dnl
 m4_popdef(<:_foreach_func:>):>)
 
+## CLRSEP
+##
+## Clear the separator.  Use in conjunction with `SEP' below.
+m4_define(<:CLRSEP:>, <:m4_define(<:__sep:>, <::>):>)m4_dnl
+
+## SEP(newsep)
+##
+## Insert the current separator, and then set the separator to NEWSEP.  This
+## is handy in `FOREACH' loops, in order to separate the items with the
+## correct number of fenceposts: call `CLRSEP' before the list, and begin
+## each item with SEP(...).
+m4_define(<:SEP:>, <:__sep<::>m4_define(<:__sep:>, <:$1:>):>)m4_dnl
+
+## DIVERT(name)
+##
+## Make _div:NAME be the current diversion.
 m4_define(<:DIVERT:>, <:m4_dnl
 m4_divert(m4_indir(<:_div:$1:>))m4_dnl
 :>)
 
+## SECTION(name, [sub])
+##
+## Contribute the following text to section NAME, inserting appropriate
+## header text to the top of the section if necessary.  If a SUB-section name
+## is given, then the contribution is made to the subsection, and the
+## subsection's header (if any) is also inserted.
 m4_define(<:SECTION:>, <:m4_dnl
 DIVERT(<:$1:>)m4_dnl
 m4_ifdef(<:_done:$1:>, <::>, <:m4_dnl
@@ -90,15 +112,77 @@ m4_ifdef(<:_done:$1/$2:>, <::>, <:m4_dnl
 m4_ifdef(<:_head:$1/$2:>, <:<:##:> m4_indir(<:_head:$1/$2:>)
 :>)m4_define(<:_done:$1/$2:>):>):>):>)
 
+## ADD_HEADER(hdrs)
+##
+## An ACL action to add the given HDRS, which are a `\n'-terminated list of
+## new header lines.
+m4_define(<:ADD_HEADER:>, <:m4_dnl
+set    acl_m_hdradd = ${if def:acl_m_hdradd{$acl_m_hdradd}{}}$1\n:>)
+
+## RENAME_HEADERS_ADD(list)
+##
+## Return a newline-separated list of message header additions of the form
+##     X-Distorted-Renamed-HEADER: VALUE
+## for each HEADER in the LIST which appears in the current message, where
+## VALUE is the HEADER's current value.
+m4_define(<:RENAME_HEADERS_ADD:>, <:m4_dnl
+FOREACH(<:\
+       ${if def:h_$:><:1:{X-CONF_header_token-Renamed-$:><:1: $h_$:><:1:\n}}:>,
+       <:$1:>):>)
+
+## RENAME_HEADERS_REMOVE(list)
+##
+## Return the LIST, with items separated by colons.
+m4_define(<:RENAME_HEADERS_REMOVE:>, <:m4_dnl
+CLRSEP<::>FOREACH(<:SEP(:)$:><:1:>, <:$1:>):>)
+
+## WARNING_HEADER(tag, msg)
+##
+## Add a warning header to the current mesage.
+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
+## information found in `$value' and expand to IF-FOUND, which may use `KV'
+## to extract keyword values, and defaults to `$value'; otherwise, obey
+## IF-NOT-FOUND, which may be the token `fail', or replacement text in
+## braces.
 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])
+##
+## 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.  The default is to expand to the extracted value or
+## nothing.
 m4_define(<:KV:>, <:${extract {$1}{$value}$2}:>)
+
+## DOMKV(key, [result])
+##
+## Extract the value of the named KEY in the ${extract ...}-style string in
+## $domain_data; see `KV'.
 m4_define(<:DOMKV:>, <:${extract {$1}{$domain_data}$2}:>)
 
 m4_divert(999)m4_dnl