[cvs] bogofilter lexer_l.l,1.8,1.9
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <re...@us...> - 2002-09-25 22:29:24
|
Update of /cvsroot/bogofilter/bogofilter In directory usw-pr-cvs1:/tmp/cvs-serv3727 Modified Files: lexer_l.l Log Message: Correct handling of multi-line "X-Spam-Whatever" headers by correctly ordering the if() statements and by checking for an empty line. Add parameter prototypes so that fewer casts are needed. Index: lexer_l.l =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/lexer_l.l,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** lexer_l.l 25 Sep 2002 00:02:44 -0000 1.8 --- lexer_l.l 25 Sep 2002 22:29:21 -0000 1.9 *************** *** 2,5 **** --- 2,11 ---- /* * $Log$ + * Revision 1.9 2002/09/25 22:29:21 relson + * Correct handling of multi-line "X-Spam-Whatever" headers by correctly ordering + * the if() statements and by checking for an empty line. + * + * Add parameter prototypes so that fewer casts are needed. + * * Revision 1.8 2002/09/25 00:02:44 relson * Ignore older X-Spam-[...Whatever...] lines. *************** *** 42,45 **** --- 48,53 ---- * lexer_l.l -- bogofilter's lexical analyzer * + * ORIG: [A-Za-z$][A-Za-z0-9$'.-]+[A-Za-z0-9$] {return(TOKEN);} + * ADAMS: [^[:blank:]\n[:digit:][:punct:]][^][:blank:]<>;=():&%$#@!+|/\\{}^\"?\*,\n[]+[^[:blank:][:punct:]\n] {return(TOKEN);} */ #include <stdlib.h> *************** *** 79,88 **** #define YY_INPUT(buf,result,max_size) result = yyinput(buf, max_size) ! int yyinput(buf, max_size) // input getter for the scanner { char *returned; ! returned = fgets((char *)buf, max_size, yyin); if (returned == NULL) { if (ferror(yyin)) { --- 87,106 ---- #define YY_INPUT(buf,result,max_size) result = yyinput(buf, max_size) ! int yyinput(char *buf, int max_size) // input getter for the scanner { char *returned; ! returned = fgets(buf, max_size, yyin); ! ! while (returned != NULL && memcmp(buf,"X-Spam-",6) == 0) ! { ! do { ! returned = fgets(buf, max_size, yyin); ! if (returned != NULL && *buf == '\n') ! break; ! } while (returned != NULL && isspace(*buf)); ! } ! if (returned == NULL) { if (ferror(yyin)) { *************** *** 100,104 **** // One very long physical line could break up into more // than one of these. ! textend->block = strdup((char *)buf); textend->next = (struct textblock *)malloc(sizeof(struct textblock)); textend->next->block = (char *)NULL; --- 118,122 ---- // One very long physical line could break up into more // than one of these. ! textend->block = strdup(buf); textend->next = (struct textblock *)malloc(sizeof(struct textblock)); textend->next->block = (char *)NULL; *************** *** 277,281 **** ^Date:.*|Delivery-Date:.* ; ^Message-ID:.* ; - ^X-Spam-[A-Za-z]+:.* ; ^{BASE64}+$ ; ^\tid\ .* ; --- 295,298 ---- *************** *** 289,292 **** --- 306,310 ---- {IPADDR} {return(TOKEN);} [^[:blank:]\n[:digit:][:punct:]][^][:blank:]<>;=():&%$#@!+|/\\{}^\"?\*,\n[]+[^[:blank:][:punct:]\n] {return(TOKEN);} + . ; \n ; |