Browse Source

* update filter stats format & fix inline config

master
Alex 'AdUser' Z 4 years ago
parent
commit
5c785fd1d0
  1. 2
      src/filter.c
  2. 5
      src/filters/filter.c

2
src/filter.c

@ -60,7 +60,7 @@ f2b_filter_load_file(f2b_filter_t *filter, const char *path) {
if ((p = strstr(p, "set: ")) != NULL) {
/* inline config line */
if ((param = f2b_config_param_create(p + 5)) != NULL) {
filter->config(filter->h, param->name, param->value);
filter->config(filter->cfg, param->name, param->value);
free(param);
}
} /* else: just comment line */

5
src/filters/filter.c

@ -40,8 +40,7 @@ stats(cfg_t *cfg, char *buf, size_t bufsize) {
char tmp[PATTERN_MAX + 64];
const char *fmt =
"- pattern: %s\n"
" matches: %d\n"
" tag: %08x\n";
" info: tag=%08X score=%d matches=%d\n";
assert(cfg != NULL);
@ -49,7 +48,7 @@ stats(cfg_t *cfg, char *buf, size_t bufsize) {
return false;
for (rx_t *rx = cfg->regexps; rx != NULL; rx = rx->next) {
snprintf(tmp, sizeof(tmp), fmt, rx->pattern, rx->matches, rx->ftag);
snprintf(tmp, sizeof(tmp), fmt, rx->pattern, rx->ftag, rx->score, rx->matches);
strlcat(buf, tmp, bufsize);
}

Loading…
Cancel
Save