Bogofilter, Cygwin, EOL issue

David Relson relson at osagesoftware.com
Wed Jan 26 13:33:39 CET 2005


On Wed, 26 Jan 2005 11:50:53 +0100
Ismael Valladolid Torres wrote:

> I compiled Bogofilter 0.93.5 on Windows using Cygwin's gcc. When used
> as a filter, it outputs DOS end-of-lines instead of UNIX
> end-of-lines. I need UNIX end-of-lines so my cygwinized Mutt displays
> messages properly. This snippet works on my .procmailrc:
> 
> :0 fw
> | bogofilter -u -e -p
> 
> :0 fw
> | dos2unix
> 
> However this behaviour seems very strange to me.
> 
> Cordially, Ismael

Hello Ismael,

An interesting experiment!  I'm not surprised to hear that Cygwin gcc
compiles bogofilter.  Using '-p' activates code in passthrough.c to
output the message.  Looking at the code, I see two possible
explanations for your problem:

First, the code uses fprintf and fputs to output an end-of-line string. 
The string is set in function write_header to either NL or CRLF
(depending on what the input looks like).  You may need to disable the
CRLF setting.

Second, fprintf and fputs may be converting the NL to a CRLF pair.  In
fact, this would be considered normal behavior for C in the DOS/Windows
environment.  You'll need to run an experiment to see what's really
happening.  Assuming fprintf is the culprit, you _could_ change
bogofilter to use fwrite(eol) to force a single character NL to be
written.  It's probably simpler to just use dos2unix.

HTH,

David




More information about the Bogofilter mailing list