Command syntax problem
David Relson
relson at osagesoftware.com
Fri Sep 24 02:49:35 CEST 2004
On Thu, 23 Sep 2004 17:11:54 -0700 (PDT)
Charles Hewson wrote:
> What did I miss in the man page. I have reread several times?
Hi Charles,
Doesn't look like you missed anything, except when using "-Q" there's no
need (or value) in also using "-I...". The 119714x..... values are just
plain wrong. Naturally, the code works fine on my 32-bit AMD processor:
[relson at osage src]$ ./bogofilter -C -D -v -M -o0.4,0.45 -Q
# bogofilter version 0.92.6
robx = 0.520000 # (5.20e-01)
robs = 0.017800 # (1.78e-02)
min_dev = 0.375000 # (3.75e-01)
ham_cutoff = 0.450000 # (4.50e-01)
spam_cutoff = 0.400000 # (4.00e-01)
ns_esf = 1.000000 # (1.00e+00)
sp_esf = 1.000000 # (1.00e+00)
Looking at the code for processing '-o0.4,0.45' I see it uses "double *"
parameters (see attachment). The excessively big numbers being printed
makes me wonder if the strtod() is doing something odd or if the
printf() formats are wrong for your architecture.
Is your SunOS machine RISC and/or 64-bit and/or big-endian???
Try the attached patch (patch.0923.SunOS.txt) and let me know what
happens. It should give 4 lines of extra output, as in:
[relson at osage src]$ ./bogofilter -C -D -v -M -o0.4,0.45 -Q
sc 0.0000, hc 0.0000
val 0.4000
val 0.4500
sc 0.4000, hc 0.4500
# bogofilter version 0.92.6
-------------- next part --------------
1) bogoconfig.c:
case 'o':
if (pass != PASS_1_CLI) {
comma_parse(option, val, &spam_cutoff, &ham_cutoff, NULL);
}
2) bogoconfig.c:
void comma_parse(char opt, const char *arg, double *parm1, double *parm2, double *parm3)
....
bool ok = ( get_parsed_value(©, parm1) &&
get_parsed_value(©, parm2) &&
get_parsed_value(©, parm3) );
3) bogoconfig.c:
static bool get_parsed_value(char **arg, double *parm)
... xatof(parm, str);
4) xatof.c
int xatof(double *d, const char *in) {
double val;
...
val = strtod(in, &end);
...
*d = val;
5) bogoconfig.c
void query_config(void)
...
fprintf(stdout, "%-11s = %0.6f # (%8.2e)\n", "ham_cutoff", ham_cutoff, ham_cutoff);
fprintf(stdout, "%-11s = %0.6f # (%8.2e)\n", "spam_cutoff", spam_cutoff, spam_cutoff);
-------------- next part --------------
--- bogoconfig.c 24 Sep 2004 00:40:36 -0000 1.191
+++ bogoconfig.c 24 Sep 2004 00:44:40 -0000
@@ -645,7 +645,9 @@
case 'o':
if (pass != PASS_1_CLI) {
+ printf("sc %6.4f, hc %6.4f\n", spam_cutoff, ham_cutoff);
comma_parse(option, val, &spam_cutoff, &ham_cutoff, NULL);
+ printf("sc %6.4f, hc %6.4f\n", spam_cutoff, ham_cutoff);
if (DEBUG_CONFIG(1))
printf("sc %6.4f, hc %6.4f\n", spam_cutoff, ham_cutoff);
}
--- xatof.c 31 Jan 2004 04:53:30 -0000 1.9
+++ xatof.c 24 Sep 2004 00:44:40 -0000
@@ -8,6 +8,7 @@
#include "xatox.h"
#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -16,6 +17,7 @@
char *end;
errno = 0;
val = strtod(in, &end);
+ printf("val %6.4f\n", val);
if (end == in /* input string empty or does not start with sign/digit */
|| end < in + strlen(in) /* junk at end of in */
|| errno == EINVAL /* SUSv3: "no conversion could be performed" */
More information about the bogofilter
mailing list