Subject: AND conditions

From: "J. Daniel Smith" <[email-masked]>
Date: Mon, 16 Jan 95 11:26:30 -0500

Right now I have a system set up where I check against two different
lists as follows:

-----
NAME_LIST="(name1|name2)"
EMAIL_LIST="([email-masked][email-masked])"

:0
* $^X-Name: ${NAME_LIST}$
* $^X-Email: ${EMAIL_LIST}$
...
-----

The intent is the "name1" goes with "[email-masked]" and "name2"
goes with "[email-masked]" (in case you are wondering, this is
the basis of an auto-response email system I have set up and I want to
be rather picky since the return message contains somewhat confidential
information).

While this works, the only catch is that "name2" from
"[email-masked]" will also work.  Not a big deal for this, but if I
added another condition, say a program they could run on my system or
something, I'd want to be even more particular.  What I'd like is a
way of specifing 
-----
:0
* $^X-Name: name1$
* $^X-Email: [email-masked]$
* $^X-Action: action1$
...
do_action action2

:0
* $^X-Name: name2$
* $^X-Email: [email-masked]$
* $^X-Action: action2$
...
do_action action2
-----
while still maintaining something like the easy-to-use *_LIST format
(these are at the top of the ~/.procmailrc file with clear
instructions for editing, nobody has to edit the actual recipes).
And w/o braces would be an added bonus :-), since the Intel Solaris 2.3
machine this is on is running 2.90 (I've tried building 3.10 but w/o
much luck).

Thanks,
   Dan
----------------------- message is author's opinion only ----------------------
J. Daniel Smith <[email-masked]>                   http://www.bristol.com/~dan
Bristol Technology Inc.	                        +1 203 438 6969, 438-5013 (FAX)
Ridgefield, Connecticut (USA)                           {info,[email-masked]
                                --------
 Von guten Maechten wunderbar geboren, erwarten wir getrost, was kommen mag.
 Gott ist mit uns am Abend und am Morgen, und ganz gewiss an jedem neuen Tag.
	- Dietrich Bonhoeffer

---

From: [email-masked] (Stephen R. van den Berg)
Date: Tue, 17 Jan 1995 20:24:16 +0100

[...strictly checked credentials and appropriate actions...]

>instructions for editing, nobody has to edit the actual recipes).

What about putting the following in your .procmailrc:

	INCLUDERC=action.rc

Create a file called action.src, and fill it with three lines like:
name1 [email-masked] action1	do_action action1
name2 [email-masked] action2	do_action action2
name3 [email-masked] action3	do_action action3

Create a shell script called "setactions":
#!/bin/sh

INPUT=$HOME/action.src
OUTPUT=$HOME/action.rc
TMPOUT=$OUTPUT.tmp

exec <$INPUT

echo '# This file is automatically generated by $0 from $INPUT' >$TMPOUT

while read name address key action
do
   case "$name" in
      ""|#) ;;			# skip comments and empty lines
      *)
         cat >>$TMPOUT <<HERE

:0
* ^X-Name: $name$
* ^X-Email: $address$
* ^X-Action: $key$
$action
HERE
         ;;
   esac
done

mv $TMPOUT $OUTPUT

exit 0
---------------------------

Now all people have to do is edit action.src and run setactions.

-- 
Sincerely,                                  [email-masked]
           Stephen R. van den Berg (AKA BuGless).

A truly wise man never plays leapfrog with a unicorn.