1 /*
2  * strmatch.h - This file is part of ncidd.
3  *
4  * Copyright (c) 2005-2019
5  * by John L. Chmielewski <jlc@users.sourceforge.net>
6  *
7  * ncidd is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * ncidd is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with ncidd.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef _STRMATCH_H
22 #define _STRMATCH_H
23 
24 #include <string.h>
25 #include <regex.h>
26 #include <pcre.h>   /* Perl regular expressions */
27 
28 #define OVECSIZE 30
29 extern int ovector[OVECSIZE]; /* PCRE buffer for lookarounds */
30 extern const char * pcreErrorMessage;
31 extern int pcreErrorOffset;
32 
33 /* remember features of an ncid simple expression
34  * for later calls to strmatch() with regex=0
35  */
36 struct abwstr {
37    char skip1;     /* flag for ^1? */
38    char star1;     /* flag for leading * */
39    char allstar;   /* flag only a star to match anything  */
40    char star2;     /* flag for trailing * */
41    int len;        /* length of the match string */
42    char * match;   /* the remaining string to be matched */
43 };
44 
45 extern int regex, ignore1;
46 
47 int strmatch(const char * string, void * regexp);
48 
49 struct abwstr * store_astrmatch(const char * string);
50 struct abwstr * store_bwstrmatch(const char * string);
51 void free_abwstr(struct abwstr * ncidreg);
52 
53 
54 #endif /* strmatch.h */
55