Browse Source

* src/filters/filter.h : add error()

master
Alex 'AdUser' Z 9 years ago
parent
commit
35dc84c0fb
  1. 1
      src/filters/filter.h
  2. 8
      src/filters/preg.c

1
src/filters/filter.h

@ -5,6 +5,7 @@
typedef struct _config cfg_t; typedef struct _config cfg_t;
extern cfg_t *create(const char *id); extern cfg_t *create(const char *id);
extern const char *error(cfg_t *c);
extern bool config(cfg_t *c, const char *key, const char *value); extern bool config(cfg_t *c, const char *key, const char *value);
extern bool append(cfg_t *c, const char *pattern); extern bool append(cfg_t *c, const char *pattern);
extern bool ready(cfg_t *c); extern bool ready(cfg_t *c);

8
src/filters/preg.c

@ -18,6 +18,7 @@ typedef struct f2b_regex_t {
struct _config { struct _config {
char id[32]; char id[32];
char error[256];
bool icase; bool icase;
f2b_regex_t *regexps; f2b_regex_t *regexps;
}; };
@ -94,6 +95,13 @@ ready(cfg_t *cfg) {
return false; return false;
} }
const char *
error(cfg_t *cfg) {
assert(cfg != NULL);
return cfg->error;
}
bool bool
match(cfg_t *cfg, const char *line, char *buf, size_t buf_size) { match(cfg_t *cfg, const char *line, char *buf, size_t buf_size) {
f2b_regex_t *r = NULL; f2b_regex_t *r = NULL;

Loading…
Cancel
Save