procmail
[Top] [All Lists]

maintaining a list that procmail can check

2001-07-05 16:48:18
OK, folks, please bear with me.  I'm trying to figure something out, so this
is a bit on the stream-of-consciousness side.

I'm thinking of a setup where procmail could check a list of filenames to see
whether the one extracted from or set for a given message is on the list or
not.  Procmail would also need to add filenames to the list or remove them
from it upon receiving passworded instructions emailed from one of my other
addresses.

So I'm looking for the setup with the most net efficiency for procmail to

(1) check whether a name is listed
(2) add a name to the list
and
(3) remove a name from the list

I figure that a flat file with one name per line is not so good; procmail
would have to call grep every time and call an editor to remove a name,
though adding a name should have little overhead by just calling cat to
append (but then again that also needs a shell).

A flat file with a regexp makes checking easier, just calling it as an
INCLUDERC:

files="(\
name1|\
name2|\
name3|\
name4\
)"

but adding would require calling an editor, and removing would require not
only calling an editor but giving special handling to the bottommost entry
because removing it would mean taking the pipe symbol off the entry above it.

I was considering keeping the filenames as hard links in a special directory
to a zero-size file.  Adding or removing would involve calling ln or rm with
no shells nor editing instructions.  Checking, though, would mean running
test for every incoming message, which may mean calling a shell [sometimes,
even when there is a /bin/test, it's a shell script that calls the shell's
`test' built-in].

All right: suppose I make the valid names hard links in a given directory to
a file containing one variable assignment.  Then instead of checking with
test, I check by trying to assign the name to INCLUDERC.  If the file exists,
the variable gets the value.  If the file does not exist, procmail reports an
error for inability to open the INCLUDERC and the variable does not get the
value.  Either way, there's no fork for checking.  A control message to add
or delete a name can simply call ln or rm, two relatively slight programs,
with no need for a shell.  (Ln will always work, because I'll keep one link
under a name that procmail will never look for; the file will never disappear
completely.)

Any improvements?
Any better approaches?

Thanks.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>