invariant terse mode [was: exit codes in docs]

David Relson relson at osagesoftware.com
Mon Aug 4 14:45:55 CEST 2003


At 05:23 AM 8/4/03, Matthias Andree wrote:

...[snip]...

>Then, we should define a machine-readable, extensible interface that
>prints a single line per mail on stdout and that a user cannot
>redefine. Casting bogofilter -tv with built-in defaults into concrete
>comes to mind. We can offer a configurable interface with a separate
>option, but I want to have a "canonical interface" that is configuration
>invariant and that people use in problem reporting and that should be
>the preferred way of using bogofilter results in a script.

At present, here's what "bogofilter -X </dev/null" does with several 
variants of flag X:

-v - prints "X-Bogosity: No, tests=bogofilter, spamicity=0.415000, 
version=0.14.2
-p - prints the contents of the message with the above line at the end of 
the headers
-t - has no visible output
-tv - prints "N 0.415000"

Both the "X-Bogosity" and the terse output line are configurable, using 
bogofilter's formatting capability.  The format specifications are:

header_format:  "%h: %c, tests=bogofilter, spamicity=%[, version=%v"
terse_format:   "%1.1c %f"

The value for "%c" is controlled by spamicity_tags, which default to 
"Yes,No,Unsure"

Also, bogotune uses flags "-tt" which set the terse_format to 
"%0.16f".  This allows it to distinguish spam scores near to 0 or 1, for 
example 0.0000000012345678 from 0.0000000087654321 (both of which print as 
0.000000 using the default format).

I'm not opposed to an invariant, terse mode.  I agree with Pi that using 
Yes, No, Unsure as default values is troublesome because one must remember 
what's being asked.

My suggestion is to use "-T" for invariant terse mode using "S/H/U" for the 
letter.  Here are some output examples:

S 0.954321
H 0.002468
U 0.499999





More information about the Bogofilter mailing list