[PATCH] -U option as the opposite of -u
David Relson
relson at osagesoftware.com
Tue Jan 28 20:11:57 CET 2003
Chris,
Good work. Still a minor detail or two to change. If folks want the '-U'
feature, I can make those changes when I do the code patch.
David
At 01:25 PM 1/28/03, Chris Wilkes wrote:
... [snip] ...
> The files I've changed:
>config.c # add "todo" and the -U switch to getopt
There's no need for todo to be defined in config.c. As it's only used in
bogofilter.c that's where it should be defined.
>main.c # add case of RUN_UPDATE_REVERSED to switch
>common.h # made "todo" of type run_t -- could change this
>bogofilter.c # updated the register_words() call
>doc/bogofilter.xml # add -U to the man page
>robinson.c # have to put run_type = RUN_UPDATE_REVERSED in if()
>
>Chris
>
>@@ -188,6 +189,9 @@
> syslog(LOG_INFO, "%s\n", msg_bogofilter);
> break;
> case RUN_UPDATE:
>+ syslog(LOG_INFO, "%s, %s\n", msg_bogofilter, msg_register);
>+ break;
>+ case RUN_UPDATE_REVERSED: /* what is the msg_register? */
> syslog(LOG_INFO, "%s, %s\n", msg_bogofilter, msg_register);
> break;
As these two cases have the same code, they can be combined. If "-l" is
used to turn on logging, msg_bogofilter is the message when classifying a
message and msg_register is the message when registering a message (or
messages). When "-u" or "-U" is used, both actions occur so the logged
message has two parts.
> default:
>--- common.h Tue Jan 21 19:04:19 2003
>+++ common.h.new Tue Jan 28 10:16:41 2003
>@@ -57,10 +57,12 @@
> typedef enum run_e {
> RUN_NORMAL='r',
> RUN_UPDATE='u',
>+ RUN_UPDATE_REVERSED='U',
> REG_SPAM='s', REG_SPAM_TO_GOOD='N',
>- REG_GOOD='n', REG_GOOD_TO_SPAM='S'
>+ REG_GOOD='n', REG_GOOD_TO_SPAM='S',
The final comma is unnecessary.
> } run_t;
> extern run_t run_type;
>+extern run_t todo;
>
> typedef struct {
> double mant;
>--- bogofilter.c Sun Jan 19 07:01:50 2003
>+++ bogofilter.c.new Tue Jan 28 10:16:41 2003
>@@ -58,6 +58,7 @@
> wordhash_t *wordhash;
> long wordcount, msgcount = 0;
> bool cont;
>+ /* todo is like run_type */
should be the declaration, i.e. "run_type todo;"
More information about the bogofilter-dev
mailing list