Rado S schreef:
Ruud H.G. van Tol:
:0hc
I don't think that h-flag matters. Doesn't it cause an error message?
Why should it? We just want the header.
Yes, for the embedded recipes, but they have their own h's.
I'll test later and report if procmail complains.
Shouldn't that be
:0 h :$LOGFOLDER$LOCKEXT
which can be simplified to
:0 h :
because procmail defaults to $LOGFOLDER$LOCKEXT there?
| printf "\n%s\n\n" $LASTFOLDER >> $LOGFOLDER
No, because it applies to a "|" not a file. Since there is no
implicit lockfile for pipes, you have to specify one.
And as you noted yourself, $LOCKEXT is implicit.
I interpret this differently, but didn't test:
<quote src="procmailrc(5)">
Local lockfile
If you put a second (trailing) ':' on the first recipe line, then proc-
mail will use a locallockfile (for this recipe only). You can option-
ally specify the locallockfile to use; if you don't however, procmail
will use the destination filename (or the filename following the first
'>>') and will append $LOCKEXT to it.
</quote>
Or capture the header contents into $MATCH and LOG that:
:0
* H ?? ^^\/(.*$)+
{
SAVELOGFILE = $LOGFILE
LOGFILE = $LOGFOLDER
LOG = "$MATCH$n$LOGFOLDER$n$n"
LOGFILE = $SAVELOGFILE
}
(where $n is a newline)
Looks nice, but suffers from the same logic mistake as my idea,
because this would have to be applied _after_ the original rules
to catch LASTFOLDER, so all _real_ rules would need some "c" and
this would mess up too much.
Seems TRAP is the only way to achieve what OP wants.
Except, instead of using LOG to write immediately, we save the
content of MATCH in some tmp-VAR to be used with TRAP:
------ QUOTE BEGIN ------
TRAP='echo "$HEADER\n\n$LASTFOLDER\n"'
0
* H ?? ^^\/(.|$)*
{ HEADER="$MATCH" }
... regular rules ...
------- QUOTE END -------
So you don't need sed anymore.
My experience is that a LOG="whatever" is never corrupted.
So you've been lucky. ;)
I was talking about a single assignment to LOG. If there are more
LOG = "blahblah"
occurences, then they can get interleaved by other procmail processes.
That is why I use a $ToLOG that I append to, and only at delivery I do
LOG = $ToLOG
--
Groet, Ruud
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail