Alan Stebbens asked,
| Stephen, it would sure be nice if we could use "m4" or some kind of
| macro facility. Imagine defining a "GET_SENDER" recipe (using m4 syntax):
|
| changequote([[, ]])
| changecom(##)
| ## define GET_SENDER(VAR) to set VAR to the best address of the SENDER
| define(GET_SENDER, [[
| :0
| * ! ^Reply-To: *\/[^ ].*
| * ! ^From: *\/[^ ].*
| * ! ^Sender: *\/[^ ].*
| * ! ^Return-Path: *\/[^ ].*
| * ! ^From +\/[^ ].*
| { $1 } # unset it and don't bother responding
| :0E
| { $1="$MATCH" }
| ]])
|
| Then, to use it is fairly simple:
|
| GET_SENDER(SENDER)
|
| Alan
If you don't mind using up an inode and hard-coding the name of the variable,
it can be done now:
INCLUDERC=/path/to/.returnaddressrc
:0
* RETURN_ADDRESS ?? .
{
reply routine
}
where .returnaddressrc contains this:
:0
* ! ^Reply-To: *\/[^ ].*
* ! ^From: *\/[^ ].*
* ! ^Sender: *\/[^ ].*
* ! ^Return-Path: *\/[^ ].*
* ! ^From +\/[^ ].*
{ RETURN_ADDRESS } # unset it and don't bother responding
:0E
{ RETURN_ADDRESS=$MATCH }
If you do mind hard-coding the name of the variable, then
INCLUDERC=/path/to/.returnaddressrc
PERPETRATOR=$RETURN_ADDRESS # or whatever variable you want
:0
* PERPETRATOR ?? .
{
reply routine
}
You can also add other header lines to consider and change the precedences
by just changing the text needing to recompile through m4 or anything else.