[cvs] bogofilter/src bogoconfig.c,1.27,1.28
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <m-...@us...> - 2003-03-27 00:48:42
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1:/tmp/cvs-serv19549/src Modified Files: bogoconfig.c Log Message: Fix -o0.9,0.1 parsing issue, allowing for -o,0.1 syntax. Index: bogoconfig.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/bogoconfig.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- bogoconfig.c 25 Mar 2003 18:25:52 -0000 1.27 +++ bogoconfig.c 27 Mar 2003 00:48:39 -0000 1.28 @@ -525,15 +525,22 @@ case 'o': { - bool ok = xatof(&spam_cutoff, optarg); - if (ok) { - char *del = strtok(optarg, ","); - if ((del = strtok(NULL, ","))) - ok = xatof(&ham_cutoff, del); + char *parse = xstrdup(optarg); + char *sc, *hc; + bool ok = true; + if (parse[0] == ',') { + sc = NULL; + hc = &parse[1]; + } else { + sc = strtok(parse, ","); + hc = strtok(NULL, ""); } + if (sc) ok = ok && xatof(&spam_cutoff, sc); + if (hc) ok = ok && xatof(&ham_cutoff, hc); if (!ok) { fprintf(stderr, "Cannot parse -%c option argument '%s'.\n", option, optarg); } + xfree(parse); break; } |