invalid switch combinatin [was: something wierd]
David Relson
relson at osagesoftware.com
Wed May 21 06:06:25 CEST 2003
At 11:38 PM 5/20/03, Rodney D. Myers wrote:
>rpm -qa | grep bogofilter
>bogofilter-0.12.2-1
>
>I've compiled from the source, and used checkinstall to make the rpm.
>Same as my friend.
Good. You're current. There are several ways to get bogofilter to display
its version number, for instance "bogofilter -V" or "bogofilter -Q".
Here's the patch I added to cvs:
Update of /cvsroot/bogofilter/bogofilter/src
In directory sc8-pr-cvs1:/tmp/cvs-serv16454
Modified Files:
bogoconfig.c
Log Message:
Revise checks for incompatible options.
Index: bogoconfig.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bogoconfig.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- bogoconfig.c 18 May 2003 15:55:47 -0000 1.67
+++ bogoconfig.c 21 May 2003 01:55:19 -0000 1.68
@@ -215,6 +215,15 @@
xfree(parse);
}
+static run_t check_run_type(run_t new, run_t conflict)
+{
+ if (run_type & conflict) {
+ (void)fprintf(stderr, "Error: Invalid combination of options.\n");
+ exit(2);
+ }
+ return (run_type | new );
+}
+
static bool config_algorithm(const unsigned char *s)
{
return select_algorithm(tolower(*s), false);
@@ -275,8 +284,8 @@
(void)fprintf(stderr,
"Error: Invalid combination of options.\n"
"\n"
+ " Options '-u' and '-R' are used when classifying
messages.\n"
" Options '-s', '-n', '-S', and '-N' are used
when registering words.\n"
- " Options '-p', '-u', '-e', and '-R' are used when
classifying messages.\n"
" The two sets of options may not be used
together.\n"
" \n"
#ifdef GRAHAM_AND_ROBINSON
@@ -525,11 +534,11 @@
break;
case 'n':
- run_type = (run_type | REG_GOOD) & ~REG_SPAM & ~UNREG_GOOD;
+ run_type = check_run_type(REG_GOOD, REG_SPAM | UNREG_GOOD);
break;
case 'N':
- run_type = (run_type | UNREG_GOOD) & ~REG_GOOD & ~UNREG_SPAM;
+ run_type = check_run_type(UNREG_GOOD, REG_GOOD | UNREG_SPAM);
break;
case 'O':
@@ -564,11 +573,11 @@
#endif
case 's':
- run_type = (run_type | REG_SPAM) & ~REG_GOOD & ~UNREG_SPAM;
+ run_type = check_run_type(REG_SPAM, REG_GOOD | UNREG_SPAM);
break;
case 'S':
- run_type = (run_type | UNREG_SPAM) & ~REG_SPAM & ~UNREG_GOOD;
+ run_type = check_run_type(UNREG_SPAM, REG_SPAM | UNREG_GOOD);
break;
case 't':
@@ -580,7 +589,7 @@
break;
case 'u':
- run_type = RUN_UPDATE;
+ run_type |= RUN_UPDATE;
break;
case 'v':
More information about the Bogofilter
mailing list