procmail
[Top] [All Lists]

Re: Controlling the procmail logfile ?

1997-08-25 15:10:30
Gulp. I hate to even try to correct David, a certified procmail guru, but
here goes...

Excerpts from [procmail]: (23-Aug-97) Re: Controlling the procmail logfile ? by 
David W Tamkin
W. Welsey Groleau wrote,
Another idea:  Some of us use the temporary backup trick that generates
file names like ..../Mail/backup/msg.xtOF  It wouldn't be hard to generate
..../Mail/logs/msg.xtOF from $LASTFOLDER.

Indeed, not hard at all, especially since we are already cd'ed to $MAILDIR:

  :0c
  backup/

  :0
  * LASTFOLDER ?? ()\/[^/]+$
  { LOGFILE=logs/$BASENAME }

$BASENAME? Do you mean $MATCH? If so, then remember that, as of 3.11pre5,
$MATCH would include the newline since you have a "$" in the regexp you are
MATCHing. That should make for some rather interesting LOGFILE names.
Unfortunately, "[^/]+" will also match the newline. "[^/].+" would not, but
that won't work in the context of what you are trying to do. Too bad you
can't put the "$" inside the brackets (i.e., [^/$]+). How about this instead?

   :0
   * LASTFOLDER ?? backup/\/.+
   { LOGFILE=logs/$MATCH }

Or, more generically:

   :0
   * LASTFOLDER ?? ()\/[^/]+
   {
       BASENAME=$MATCH

       :0
       * BASENAME ?? ^^\/.+
       { LOGFILE=logs/$MATCH }
   }

But that seems a little unnecessarily cumbersome to me. The former would only
fail in circumstances where $MAILDIR included the string "backup/" which is
probably highly unlikely.

Later,
Ed

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