145
146
static bool esf_flag = true; /* test ESF factors if true */
146
147
static bool exit_zero = false; /* non-error exits zero */
147
static char *bogolex_file = NULL; /* non-NULL if creating msg-count output */
148
static const char *bogolex_file = NULL; /* non-NULL if creating msg-count output */
148
149
static word_t *w_msg_count;
150
151
static uint message_count;
187
188
bool fMakeCheck = false; /* allows quick & dirty regression testing */
188
189
uint cMakeCheck = 50; /* ... for 50 cycles */
191
const char *logtag = NULL;
192
const char *spam_header_place = "";
190
194
/* Function Declarations */
192
static void process_bogotune_arg(int option);
194
196
/* Function Definitions */
196
198
static void bt_trap(void) {}
200
static bool get_bool(const char *name, const char *arg)
202
bool b = str_to_bool(arg);
204
fprintf(dbgout, "%s -> %s\n", name,
198
209
static int get_cnt(double fst, double lst, double amt)
200
211
int cnt = (fabs(lst - fst) + EPS) / (fabs(amt) - EPS) + 1;
711
722
static void print_msgcount_entry(const char *token, uint bad, uint good)
713
printf( "\"%s\" %u %u\n", token, bad, good);
724
printf("\"%s\" %u %u\n", token, bad, good);
716
727
static void write_msgcount_file(wordhash_t *wh)
741
static uint read_mailbox(char *arg, mlhead_t *msgs)
752
static uint read_mailbox(const char *arg, mlhead_t *msgs)
744
755
printf("Reading %s\n", arg);
961
972
int option_index = 0;
962
973
int this_option_optind = optind ? optind : 1;
963
974
const char *name;
965
977
option = getopt_long(argc, argv, OPTIONS,
966
978
longopts_bogotune, &option_index);
971
983
name = (option_index == 0) ? argv[this_option_optind] : longopts_bogotune[option_index].name;
973
process_bogotune_arg(option);
986
process_arg(option, NULL, val, PR_NONE, PASS_1_CLI);
976
989
if (ds_flag == DS_NONE) /* default is "wordlist on disk" */
997
static void process_bogotune_arg(int option)
1010
int process_arg(int option, const char *name, const char *val, priority_t precedence, arg_pass_t pass)
999
1012
static int lastmode = -1;
1014
(void) name; /* suppress compiler warning */
1015
(void) precedence; /* suppress compiler warning */
1016
(void) pass; /* suppress compiler warning */
1001
1018
if (option == 1) {
1002
1019
/* If getopt's RETURN_IN_ORDER behavior */
1003
1020
switch (lastmode) {
1014
1031
switch (option) {
1016
read_config_file(optarg, false, false, PR_CFG_USER, longopts_bogotune);
1033
read_config_file(val, false, false, PR_CFG_USER, longopts_bogotune);
1035
/* fall through to suppress reading config files */
1019
1038
suppress_config_file = true;
1022
ds_path = xstrdup(optarg);
1042
ds_path = xstrdup(val);
1023
1043
ds_flag = (ds_flag == DS_NONE) ? DS_DSK : DS_ERR;
1026
1047
ds_flag = (ds_flag == DS_NONE) ? DS_RAM : DS_ERR;
1029
1051
exit_zero = true;
1032
1055
esf_flag ^= true;
1035
bogolex_file = optarg;
1038
1063
lastmode = 'n';
1039
filelist_add(ham_files, optarg);
1064
filelist_add(ham_files, val);
1045
user_robx = atof(optarg);
1072
user_robx = atof(val);
1048
1076
lastmode = 's';
1049
filelist_add(spam_files, optarg);
1077
filelist_add(spam_files, val);
1057
coerced_target = atoi(optarg);
1086
coerced_target = atoi(val);
1063
1094
print_version();
1066
if (strcmp(optarg, "MakeCheck") == 0)
1098
if (strcmp(val, "MakeCheck") == 0)
1067
1099
fMakeCheck = true;
1069
set_debug_mask( optarg );
1101
set_debug_mask(val);
1072
1104
case O_MAX_TOKEN_LEN:
1073
max_token_len = atoi(optarg);
1105
max_token_len = atoi(val);
1076
1108
case O_MIN_TOKEN_LEN:
1077
min_token_len = atoi(optarg);
1109
min_token_len = atoi(val);
1080
1112
case O_MAX_MULTI_TOKEN_LEN:
1081
max_multi_token_len=atoi(optarg);
1113
max_multi_token_len=atoi(val);
1084
1116
case O_MULTI_TOKEN_COUNT:
1085
multi_token_count=atoi(optarg);
1117
multi_token_count=atoi(val);
1120
case O_BLOCK_ON_SUBNETS:
1121
block_on_subnets = get_bool(name, val);
1124
case O_REPLACE_NONASCII_CHARACTERS:
1125
replace_nonascii_characters = get_bool(name, val);
1090
1130
exit(EX_ERROR);
1094
1136
static double get_robx(void)