2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or (at
5 * your option) any later version.
7 * This program is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * Copyright © 2006 Pierre Habouzit
20 * This file is part of mutt-ng, see http://www.muttng.org/.
21 * It's licensed under the GNU General Public License,
22 * please see the file GPL in the top level source directory.
26 * this is an internal abstraction layer for regular expressions
29 #ifndef MUTT_LIB_LIB_RX_H
30 #define MUTT_LIB_LIB_RX_H
32 #include <lib-lib/lib-lib.h>
34 /* this is a non-standard option supported by Solaris 2.5.x which allows
35 * patterns of the form \<...\>
43 char *pattern; /* printable version */
44 regex_t *rx; /* compiled expression */
45 int not; /* do not match */
47 int nmatch; /* nb matches */
48 char *template; /* out template */
51 rx_t* rx_compile(const char*, int);
52 void rx_set_template(rx_t *, const char*);
53 void rx_delete(rx_t **);
54 DO_SLIST(rx_t, rx, rx_delete);
56 /* for handling lists */
57 int rx_list_match(rx_t *, const char*); /* match all items list agains string */
58 int rx_list_match2(rx_t *l, const char *s, char *dst, int dlen);
59 rx_t **rx_lookup(rx_t**, const char*); /* lookup pattern */
60 int rx_sanitize_string(char *, ssize_t, const char *);
62 #define REGCOMP(X,Y,Z) regcomp(X, Y, REG_WORDS|REG_EXTENDED|(Z))
63 #define REGEXEC(X,Y) regexec(X, Y, 0, NULL, 0)
65 #endif /* !MUTT_LIB_LIB_RX_H */