[cvs] bogofilter/src bogoreader.c,1.30,1.31
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <re...@us...> - 2003-09-20 23:18:19
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1:/tmp/cvs-serv7524 Modified Files: bogoreader.c Log Message: Allow the message separator format that lacks a count. Index: bogoreader.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/bogoreader.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- bogoreader.c 20 Sep 2003 11:33:43 -0000 1.30 +++ bogoreader.c 20 Sep 2003 23:18:15 -0000 1.31 @@ -422,9 +422,11 @@ /* reads from an rmail batch, paying attention to ^#! rmail lines */ static int brmail_getline(buff_t *buff) { + int count; size_t used = buff->t.leng; byte *buf = buff->t.text + used; - int count; + const char *separator = "#! rmail"; + const int seplen = 8; static word_t *saved = NULL; static unsigned long bytesleft; @@ -445,12 +447,12 @@ count = buff_fgetsl(buff, fpin); have_message = false; - if ((firstline || emptyline) && - count >= 9 && memcmp("#! rmail ", buf, 9) == 0) + if (count >= seplen && memcmp(separator, buf, seplen) == 0) { int i; bytesleft = 0; - for (i = 9; i < count; i++) { + for (i = seplen; i < count; i++) { + if (isspace(buf[i])) continue; if (!isdigit(buf[i])) break; bytesleft = bytesleft * 10 + (buf[i] - '0'); } |