tbac(_at_)mail(_dot_)idt(_dot_)net wrote:
:I want to pipe the subject of all mail to a "C" program. And pending
:on the result (true or false) either send to /dev/nul or pass it
:along for the rest of the .procmailrc file to finish processing it.
:But I'm not sure how this is done. Can some one tell me what
:the receipt would look like?
You don't say that you want the C program to modify the data, just
make a decision on it.
The trick is to make the C program exit with a return code of 0 (that
is, "good") if you want the condition fulfilled, and nonzero if you
don't. So in this case return 0 if you want the mail to be discarded.
A sample recipe:
:0w
* ? $HOME/myprogram command line parameters here, if you want them
/dev/null
:Also as far as the c program. How does it get the info? Throught
:fscanf(stdin,"%s",sub)? or would it be a command line argument?
You can use command-line arguments to pass parameters to the program,
but the input comes through standard input. If you're going to read
each line as a string, don't use fscanf(); a better way is to call
fgets(). If you call fgets() correctly, you _know_ that no line will
be so long that it overruns your buffer and wipes out other data.
--
Bill Evans