Lines Matching refs:opts

45 void opts_free(opts_t opts)  in opts_free()  argument
47 if (!opts) in opts_free()
49 if (opts->argv) in opts_free()
50 free(opts->argv); in opts_free()
51 if (opts->plaindata) in opts_free()
52 spam_plaintext_free(opts); in opts_free()
53 free(opts); in opts_free()
130 opts_t opts; in opts_parse() local
132 opts = calloc(1, sizeof(*opts)); in opts_parse()
133 if (!opts) { in opts_parse()
141 opts->program_name = argv[0]; in opts_parse()
143 opts->argc = 0; in opts_parse()
144 opts->argv = calloc(argc + 1, sizeof(char *)); in opts_parse()
145 if (!opts->argv) { in opts_parse()
151 opts_free(opts); in opts_parse()
155 opts->threshold = 0.9; in opts_parse()
156 opts->min_token_count = 0; in opts_parse()
157 opts->prune_max = 100000; in opts_parse()
159 opts->db1weight = 1; in opts_parse()
160 opts->db2weight = 1; in opts_parse()
161 opts->db3weight = 1; in opts_parse()
163 opts->action = ACTION_TEST; in opts_parse()
164 opts->showprune = 0; in opts_parse()
181 opts->action = ACTION_NONE; in opts_parse()
182 return opts; in opts_parse()
186 opts->action = ACTION_NONE; in opts_parse()
187 return opts; in opts_parse()
190 opts->modify_subject = 1; in opts_parse()
193 opts->modify_subject = 1; in opts_parse()
194 opts->subject_marker = optarg; in opts_parse()
197 opts->header_marker = optarg; in opts_parse()
200 opts->no_header = 1; in opts_parse()
203 opts->add_rating = 1; in opts_parse()
206 opts->add_stars = 1; in opts_parse()
209 opts->no_filter = 1; in opts_parse()
212 opts->allowlist = 1; in opts_parse()
215 opts->denylist = 1; in opts_parse()
218 opts->threshold = (double) (atoi(optarg)) / 100; in opts_parse()
221 opts->min_token_count = atoi(optarg); in opts_parse()
224 opts->emailonly = optarg; in opts_parse()
225 opts->allowlist = 1; in opts_parse()
228 opts->modifydenylist = 0; in opts_parse()
229 if (opts->action == ACTION_MARK_SPAM) in opts_parse()
230 opts->modifydenylist = 1; in opts_parse()
231 opts->action = ACTION_MARK_SPAM; in opts_parse()
234 opts->modifydenylist = 0; in opts_parse()
235 if (opts->action == ACTION_MARK_NONSPAM) in opts_parse()
236 opts->modifydenylist = 1; in opts_parse()
237 opts->action = ACTION_MARK_NONSPAM; in opts_parse()
240 opts->database = optarg; in opts_parse()
243 if (opts->globaldb) { in opts_parse()
244 opts->globaldb2 = optarg; in opts_parse()
246 opts->globaldb = optarg; in opts_parse()
250 opts->plainmap = optarg; in opts_parse()
253 opts->weight = atoi(optarg); in opts_parse()
256 opts->action = ACTION_TRAIN; in opts_parse()
257 opts->showprune = 1; in opts_parse()
260 opts->noautoprune = 1; in opts_parse()
263 opts->prune_max = atol(optarg); in opts_parse()
266 opts->action = ACTION_PRUNE; in opts_parse()
267 opts->showprune = 1; in opts_parse()
270 opts->action = ACTION_DUMP; in opts_parse()
273 opts->action = ACTION_RESTORE; in opts_parse()
276 opts->action = ACTION_TOKENS; in opts_parse()
279 opts->action = ACTION_BENCHMARK; in opts_parse()
280 opts->showprune = 1; in opts_parse()
283 opts->action = ACTION_MERGE; in opts_parse()
284 opts->mergefrom = optarg; in opts_parse()
287 opts->loglevel++; in opts_parse()
300 opts_free(opts); in opts_parse()
307 log_level(opts->loglevel); in opts_parse()
309 if (opts->weight < 1) { in opts_parse()
310 opts->weight = 1; in opts_parse()
311 } else if (opts->weight > 8) { in opts_parse()
312 opts->weight = 8; in opts_parse()
315 if (opts->threshold < 0.01) { in opts_parse()
316 opts->threshold = 0.01; in opts_parse()
317 } else if (opts->threshold > 1.00) { in opts_parse()
318 opts->threshold = 1.00; in opts_parse()
321 if (opts->prune_max < 10) in opts_parse()
322 opts->prune_max = 10; in opts_parse()
325 opts->argv[opts->argc++] = argv[optind++]; in opts_parse()
328 if ((opts->action == ACTION_TRAIN) in opts_parse()
329 && ((opts->argc < 2) || (opts->argc > 3))) { in opts_parse()
332 opts_free(opts); in opts_parse()
334 } else if ((opts->action == ACTION_BENCHMARK) in opts_parse()
335 && ((opts->argc < 2) || (opts->argc > 3))) { in opts_parse()
338 opts_free(opts); in opts_parse()
340 } else if ((opts->action == ACTION_DUMP) && (opts->argc > 1)) { in opts_parse()
344 opts_free(opts); in opts_parse()
346 } else if ((opts->action == ACTION_RESTORE) && (opts->argc > 1)) { in opts_parse()
350 opts_free(opts); in opts_parse()
352 } else if ((opts->action != ACTION_DUMP) in opts_parse()
353 && (opts->action != ACTION_RESTORE) in opts_parse()
354 && (opts->action != ACTION_TRAIN) in opts_parse()
355 && (opts->action != ACTION_BENCHMARK) in opts_parse()
356 && (opts->argc > 0) in opts_parse()
361 opts_free(opts); in opts_parse()
365 return opts; in opts_parse()