Andreas Krennmair:
[apps/madmutt.git] / mutt_regex.h
1 /*
2  * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
3  * 
4  *     This program is free software; you can redistribute it and/or modify
5  *     it under the terms of the GNU General Public License as published by
6  *     the Free Software Foundation; either version 2 of the License, or
7  *     (at your option) any later version.
8  * 
9  *     This program is distributed in the hope that it will be useful,
10  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *     GNU General Public License for more details.
13  * 
14  *     You should have received a copy of the GNU General Public License
15  *     along with this program; if not, write to the Free Software
16  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
17  */
18
19 /*
20  * A (more) generic interface to regular expression matching
21  */
22
23 #ifndef MUTT_REGEX_H
24 #define MUTT_REGEX_H
25
26 #ifdef USE_GNU_REGEX
27 #include "_regex.h"
28 #else
29 #include <regex.h>
30 #endif
31
32 /* this is a non-standard option supported by Solaris 2.5.x which allows
33  * patterns of the form \<...\>
34  */
35 #ifndef REG_WORDS
36 #define REG_WORDS 0
37 #endif
38
39 #define REGCOMP(X,Y,Z) regcomp(X, Y, REG_WORDS|REG_EXTENDED|(Z))
40 #define REGEXEC(X,Y) regexec(&X, Y, (size_t)0, (regmatch_t *)0, (int)0)
41
42 typedef struct {
43   char *pattern;                /* printable version */
44   regex_t *rx;                  /* compiled expression */
45   int not;                      /* do not match */
46 } REGEXP;
47
48 WHERE REGEXP Mask;
49 WHERE REGEXP QuoteRegexp;
50 WHERE REGEXP ReplyRegexp;
51 WHERE REGEXP Smileys;
52 WHERE REGEXP GecosMask;
53 WHERE REGEXP StripWasRegexp;
54
55 #endif /* MUTT_REGEX_H */