procmail
[Top] [All Lists]

Re: Getting the 'nth header

1998-09-01 08:05:22
Walter Dnes <waltdnes(_at_)interlog(_dot_)com> writes:
...
############### Multiple headers from the bottom ###############
 Because of procmail's "greedy matching", I haven't been able
to do a simple match from the bottom up.

 This regex gets the last header PLUS A BLANK LINE PLUS THE
FIRST CHARACTER ON THE FIRST LINE OF THE BODY!!!
*  ()\/$+.*$$

This is the result of a known bug in procmail's matching code, where
when the match starts with a newline, it pushes the match forward one
character to drop the newline, but fails to shorten the match length
accordingly.  You can fix it in the source by either adding a "len--"
to the correct spot in regex.c, or by removing the chunk of code that
does the "skip one leading newline", as that is not considered a
feature by many.  I think jari's pm-tips page has an actual patch to do
one of those, though I can't remember which.


Philip Guenther

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