doctor(_at_)netcom(_dot_)com elucidated:
| Here's what I really want...
|
| If a msg. comes in (any body or none), and the subject BEGINS "send ", I
| want it to parse out the rest as in this example:
|
| send uuencode sat-am.zip 1000
|
| Word 2, 'uuencode', is the format I need to parse out in some way... (Only
| other I'll deal with is MIME, but I suppose I could do this with a simple
| recipe, so don't need this in a var., really...)
|
| Word 3 is the filename, and it can and will change AT WILL... I need a bit
| of unpredictability here. (However, my known (so far!) extensions will
| either be .zip or .txt.)
|
| Word 4 will be a split size, which I'll prob. only use on uuencode, and
| needs to represent the number of lines to split the encoding at.
OK. Let's see how we can set this up. First, save the entire subject into
a variable so that procmail doesn't have to egrep the header again with
every recipe, and let's set up some convenient variables for regexps that
we'll need repeatedly. Each set of brackets encloses a space and a tab
or a caret, a space, and a tab:
SPACE="[ ]+"
MAYBESPACE="[ ]*"
WORD="[^ ]+"
One annoying complication: the need to use the $ modifier on the conditions
to get expansion of variables means that we'll need to use \\/ instead of
just \/ as the match separator.
:0
* $ ^Subject:${MAYBESPACE}send$SPACE\\/$WORD.*
{
# save the words after "send" in a variable
parameters=$MATCH
:0
* $ parameters ?? ^^\\/$WORD
{ encoding=$MATCH }
:0
* $ parameters ?? ^^$encoding$SPACE\\/$WORD
{ filename=$MATCH }
# You can tighten the requirements for the form a filename has to match
# instead of accepting any word at all, and then do some error handling
# with a :0E recipe.
:0
* encoding ?? uuencode
* $ parameters ?? ^^$encoding$SPACE$filename$SPACE\\/$WORD
{ size=$MATCH }
# And continue handling as you desire, remembering to close the outer braces.
}