procmail
[Top] [All Lists]

Re: Troubles with $MATCH

2003-12-10 08:39:13
Mike had, as quoted by Sean,

  :0
  * $ $GO^0 ^TO_$\PLUS\/$IDENT(_at_)$\SITE
  * $ $GO^0       ^TO_\/$IDENT(_at_)$\SITE
  {
    :0:
    * MATCH ??        ^^$IDENT
    ".email_alias_$MATCH"
  }

Ruud has already pointed out, and Mike has acknowledged, that the last condition needed the "$" modifier.

Sean corrected Mike (and by typing his name as "Sedan" I gave him a chance to correct me but caught it in time -- Sedan, sheesh),

No real need to drop into the braced sub-recipe.  $MATCH is set during the
processing of the conditions, so if you make it the third condition...

In a subsequent correction, Mike indicated that the third condition should actually be

 * $ MATCH ?? ^^\/$IDENT

in order to strip $\SITE from the right before using it in the filename.
In some of the older versions of procmail just after extraction was introduced, you did need to drop into braces to do that, because if you attempted to rematch on MATCH, procmail would clobber MATCH first. So while this works now,

   :0:
   * $ $GO^0 ^TO_$\PLUS\/$IDENT(_at_)$\SITE
   * $ $GO^0 ^TO_\/$IDENT(_at_)$\SITE
   * $ MATCH ?? ^^\/$IDENT
   ".email_alias_$MATCH"

in those days you had to do this,

   :0
   * $ $GO^0 ^TO_$\PLUS\/$IDENT(_at_)$\SITE
   * $ $GO^0 ^TO_\/$IDENT(_at_)$\SITE
   {
    IDENTANDSITE=$MATCH
    :0:
    * $ IDENTANDSITE ?? ^^\/$IDENT
    ".email_alias_$MATCH"
   }

or

   :0
   * $ $GO^0 ^TO_$\PLUS\/$IDENT(_at_)$\SITE
   * $ $GO^0 ^TO_\/$IDENT(_at_)$\SITE
   { IDENTANDSITE=$MATCH }
    :0A:
    * $ IDENTANDSITE ?? ^^\/$IDENT
    ".email_alias_$MATCH"

The way the code appeared before, not using the other variable, would not have worked then, but there did use to be a reason for dropping into braces.


_______________________________________________
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>