X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-lib%2Frx.h;h=b976fc19ce44dd0b9b4ab7a22f1b0e9ec729941f;hp=48e295ba4b7acccef2af9de0ce5942b1040009bc;hb=6b771604433435b4280a5fbae2612134fe4129dd;hpb=03fe827a7d4a7ad79ac235654414aa339a9a2c9a diff --git a/lib-lib/rx.h b/lib-lib/rx.h index 48e295b..b976fc1 100644 --- a/lib-lib/rx.h +++ b/lib-lib/rx.h @@ -26,13 +26,10 @@ * this is an internal abstraction layer for regular expressions */ -#ifndef _LIB_RX_H -#define _LIB_RX_H +#ifndef MUTT_LIB_LIB_RX_H +#define MUTT_LIB_LIB_RX_H -#include -#include - -#include "../lib/list.h" +#include /* this is a non-standard option supported by Solaris 2.5.x which allows * patterns of the form \<...\> @@ -42,19 +39,30 @@ #endif typedef struct rx_t { + struct rx_t *next; char *pattern; /* printable version */ regex_t *rx; /* compiled expression */ int not; /* do not match */ + + int nmatch; /* nb matches */ + char *template; /* out template */ } rx_t; -rx_t* rx_compile (const char*, int); -void rx_delete(rx_t **); +rx_t *rx_compile(const char*, int); +int rx_validate(const char*, char*, ssize_t); +void rx_set_template(rx_t *, const char*); +void rx_wipe(rx_t *); +DO_DELETE(rx_t, rx); + +DO_SLIST(rx_t, rx, rx_delete); /* for handling lists */ -int rx_list_match(list2_t*, const char*); /* match all items list agains string */ -int rx_lookup(list2_t*, const char*); /* lookup pattern */ +int rx_list_match(rx_t *, const char*); /* match all items list agains string */ +int rx_list_match2(rx_t *l, const char *s, char *dst, int dlen); +rx_t **rx_lookup(rx_t**, const char*); /* lookup pattern */ +int rx_sanitize_string(char *, ssize_t, const char *); #define REGCOMP(X,Y,Z) regcomp(X, Y, REG_WORDS|REG_EXTENDED|(Z)) #define REGEXEC(X,Y) regexec(X, Y, 0, NULL, 0) -#endif /* !_LIB_RX_H */ +#endif /* !MUTT_LIB_LIB_RX_H */