procmail
[Top] [All Lists]

Procmail {block} and :0c (was: Help)

1997-01-22 01:01:56
[Mailed and mailed.]

On Tue, 21 Jan 1997 10:32:33 -0500, Dale King <dnking(_at_)bellsouth(_dot_)net>
wrote:
Need help with following rc. I'm a procmail newbie and struggling a bit
with the {} construct vs. 0:c carbon option. When rc parses as below,
only the first cat command gets executed. Should I use the "c" on 2nd
and 3rd recipes? 

No -- on the first and second. Here's a pseudocode example for y'all (-:

:0
* Something
{
# Want to do all three things now that Something matched
    :0c
    storage

    :0c
    | $HOME/bin/auto-reply

    :0
    ! cc(_at_)elsewhere
}

The manual page documents pretty clearly (IMHO) what the c flag does: 

       this  will  clone  the running procmail process (lockfiles will not be
       inherited), whereas the clone will proceed as  usual  and  the  parent
       will jump across the block.

So the first c will spawn a copy which delivers to the folder
"storage". The spawning parent will skip the "storage" part and jump
to the next recipe, which also has a c flag. Again, the parent will
spawn off a child and proceed to the next recipe. The child pipes the
message to the script auto-reply and then terminates, having delivered
its mail. Finally, the parent gets to the last recipe, which doesn't
have a c flag. So the parent (the original Procmail process) forwards
the message to cc(_at_)elsewhere, and is finished. Procmail quits, having
delivered the mail, and reports success. 
  (If the Unix fork() system call sounds completely unfamiliar to you,
you shouldn't expect to understand this anyway, I suppose ...)

Meanwhile, this one looks a bit overworked to me:

   :0 #store original email
   | cat > $HOME/$EMAILID 

Why not just 

    :0
    $HOME/$EMAILID

... since you're saying $EMAILID will be unique, this should create a
new file each time, and save you another Useless Use of Cat. (I might
use locking here, too. You never do know.)

Hope this helps,

/* era */

PS. Using sensible Subject lines will earn you extra brownie points.

-- 
See <http://www.ling.helsinki.fi/~reriksso/> for mantra, disclaimer, etc.
* If you enjoy getting spam, I'd appreciate it if you'd register yourself
  at the following URL:  <http://www.ling.helsinki.fi/~reriksso/spam.html>

<Prev in Thread] Current Thread [Next in Thread>
  • Help, Dale King
    • Procmail {block} and :0c (was: Help), era eriksson <=