[cvs] bogofilter/src bogolexer.c,1.78,1.79
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <re...@us...> - 2004-12-30 22:11:27
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27185/src Modified Files: bogolexer.c Log Message: Added option '-O file' to specify output file. Index: bogolexer.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/bogolexer.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -d -r1.78 -r1.79 --- bogolexer.c 28 Dec 2004 16:24:23 -0000 1.78 +++ bogolexer.c 30 Dec 2004 22:11:18 -0000 1.79 @@ -57,6 +57,7 @@ "\t-C\t- don't read standard config files.\n" "\t-H\t- disables header line tagging.\n" "\t-I file\t- read message from file instead of stdin.\n" + "\t-O file\t- write to file instead of stdout.\n" "\t-x list\t- set debug flags.\n" "\t-D\t- direct debug output to stdout.\n"); fprintf(stderr, @@ -96,7 +97,7 @@ return s; } -#define OPTIONS ":c:CDhHI:npqvVx:X:m" +#define OPTIONS ":c:CDhHI:nO:pqvVx:X:m" /** These functions process command line arguments. ** @@ -189,6 +190,10 @@ bogoreader_name(val); break; + case 'O': + fpo = fopen(val, "wt"); + break; + case 'n': replace_nonascii_characters = true; break; @@ -282,6 +287,8 @@ { token_t t; + fpo = stdout; + mbox_mode = true; /* to allow multiple messages */ process_arglist(argc, argv); @@ -292,9 +299,9 @@ if (!passthrough) { if (quiet) - puts( "quiet mode."); + fprintf(fpo, "quiet mode."); else - puts("normal mode."); + fprintf(fpo, "normal mode."); } bogoreader_init(argc, argv); @@ -306,15 +313,15 @@ { count += 1; if (passthrough) { - fprintf(stdout, "%s\n", yylval->text); + fprintf(fpo, "%s\n", yylval->text); } else if (!quiet) - printf("get_token: %d \"%s\"\n", (int)t, yylval->text); + fprintf(fpo, "get_token: %d \"%s\"\n", (int)t, yylval->text); } } if ( !passthrough ) - printf( "%d tokens read.\n", count ); + fprintf(fpo, "%d tokens read.\n", count); textblock_free(); |