procmail
[Top] [All Lists]

RE: Would someone please explain the f-flag?

1996-03-27 04:09:18
On Sunday, March 24, 1996 8:24 AM, Philip 
Guenther[SMTP:guenther(_at_)gac(_dot_)edu] wrote:
dman(_at_)netcom(_dot_)com (Dallman Ross) writes:
I have looked over the man pages countelss times; but I still find
the explanation for the f-flag (paraphrasing: "cause the pipe to
act as a filter") to be just a little too terse.  :-)  Would someone
be so kind as to explain just how and when I might want to use the
f-flag?  Much appreciated.

The 'f' flag causes procmail to feed the message (or just the head or
body of the message if either 'h' or 'b' flag, respectively, is given)
as stdin into the action (which should be a '|' program action).  It
then catches the stdout of the action and uses that to replace whatever
it fed into the action (i.e., if it fed just the head, then only the
head will be replaced, leaving the body unchanged).  This allows you to
use any of the hoard of UNIX tools that follow the stdin/stdout
convention as filters through which you can stuff a message (or just
the head or body).  I have this image of procmail standing in front of
a huge shelf that holds a whole bunch of tubes with labels like "sed",
"formail", and "mimencode".  Then upon seeing something like:

:0 fbw
*     ^Content-Type: *text/plain
*     ^Content-Transfer-Encoding: *quoted-printable
| mimencode -u -q

:0 Afhw
| formail -I "Content-Transfer-Encoding: 8bit"


Upon seeing a match, procmail grabs the "mimencode -u -q" tube and rips
the message in two at the head/body boundary, then stuffs the body into
the tube, catching what comes out the other side, and patches it back
to the header.  Then it sees the second recipe, rips the message back
in two, and stuffs the header into the "formail -I...." tube.  The
output is slapped back onto the front of the body and off it goes.

Does that help explain it?  Or does it just reveal how strange I am?

Philip Guenther


I've had to re-read it about 3 times, but now I think I get it. :-)
Much appreciated.  (But my mind is still trying to figure out 
how this could be done without the f-flag, and how much
easier its use makes the task.)

No, I don't think it's strange at all. :-)  But maybe I'm strange.
--
|) /\ |_ |_ |\/| /\ |\|  "Hey, some of my best friends are Mac users!"

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