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) { if ((p = strstr(p, "set: ")) != NULL) {
/* inline config line */ /* inline config line */
if ((param = f2b_config_param_create(p + 5)) != NULL) { 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); free(param);
} }
} /* else: just comment line */ } /* 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]; char tmp[PATTERN_MAX + 64];
const char *fmt = const char *fmt =
"- pattern: %s\n" "- pattern: %s\n"
" matches: %d\n" " info: tag=%08X score=%d matches=%d\n";
" tag: %08x\n";
assert(cfg != NULL); assert(cfg != NULL);
@ -49,7 +48,7 @@ stats(cfg_t *cfg, char *buf, size_t bufsize) {
return false; return false;
for (rx_t *rx = cfg->regexps; rx != NULL; rx = rx->next) { 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); strlcat(buf, tmp, bufsize);
} }

Loading…
Cancel
Save