FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
nomos_regex.h
1 /***************************************************************
2  Copyright (C) 2006-2009 Hewlett-Packard Development Company, L.P.
3  Copyright (C) 2014, Siemens AG
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  version 2 as published by the Free Software Foundation.
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 along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 
18  ***************************************************************/
19 
20 #ifndef _NOMOS_REGEX_H
21 #define _NOMOS_REGEX_H
22 #include <regex.h>
23 #include <ctype.h>
24 #include "nomos.h"
25 #include "util.h"
26 #include "_autodefs.h"
27 
28 regex_t regc[NFOOTPRINTS];
29 
30 void regexError(int ret, regex_t *regc, char *regex);
31 int endsIn(char *s, char *suffix);
32 int lineInFile(char *pathname, char *regex);
33 int textInFile(char *pathname, char *regex, int flags);
34 int strGrep(char *regex, char *data, int flags);
35 int idxGrep(int index, char *data, int flags);
36 int idxGrep_recordPosition(int index, char *data, int flags);
37 int idxGrep_recordPositionDoctored(int index, char *data, int flags);
38 int idxGrep_recordIndex(int index, char *data, int flags);
39 int idxGrep_base(int index, char *data, int flags, int mode);
40 int strNbuf(char *data, char *str);
41 int strNbuf_noGlobals(char *data, char *str , regmatch_t* matchPos, int doSave , char* saveData);
42 int matchOnce(int isPlain,char *data, char* regex, regex_t *rp, regmatch_t* regmatch );
43 regmatch_t* getRegmatch_t(GArray* in,int index);
44 void rememberWhatWeFound(GArray* highlight, GArray* regmatch_tArray, int index, int mode);
45 void recordIndex(GArray* indexList, int index);
46 
47 #endif /* _NOMOS_REGEX_H */
regmatch_t * getRegmatch_t(GArray *in, int index)
From a given array, get regex match from a given index.
Definition: nomos_regex.c:484
int idxGrep_base(int index, char *data, int flags, int mode)
compile a regex, and perform the search (on data?)
Definition: nomos_regex.c:335
int idxGrep_recordPosition(int index, char *data, int flags)
compile a regex, perform the search and record findings
Definition: nomos_regex.c:231
int s
The socket that the CLI will use to communicate.
Definition: fo_cli.c:48
int endsIn(char *s, char *suffix)
Check if a string ends with given suffix.
Definition: nomos_regex.c:67
int textInFile(char *pathname, char *regex, int flags)
Check if a regex passes in a file.
Definition: nomos_regex.c:111
int idxGrep_recordPositionDoctored(int index, char *data, int flags)
compile a regex, perform the search and record findings
Definition: nomos_regex.c:252
int strNbuf(char *data, char *str)
Check if a string exists in buffer (case insensitive)
Definition: nomos_regex.c:539
int lineInFile(char *pathname, char *regex)
Check if a line exists in a file.
Definition: nomos_regex.c:92
int idxGrep(int index, char *data, int flags)
compile a regex, and perform the search (on data?)
Definition: nomos_regex.c:216
void recordIndex(GArray *indexList, int index)
Add a given index to index list.
Definition: nomos_regex.c:463
int strNbuf_noGlobals(char *data, char *str, regmatch_t *matchPos, int doSave, char *saveData)
This is our own internal, case-insensitive version of strstr().
Definition: nomos_regex.c:549
void rememberWhatWeFound(GArray *highlight, GArray *regmatch_tArray, int index, int mode)
Store regex matches in highlight array.
Definition: nomos_regex.c:496
int strGrep(char *regex, char *data, int flags)
General-purpose grep function, used for one-time-only searches.
Definition: nomos_regex.c:150
Nomos header file.
int matchOnce(int isPlain, char *data, char *regex, regex_t *rp, regmatch_t *regmatch)
Perform a regex match on a given data and return only first match.
Definition: nomos_regex.c:293
int idxGrep_recordIndex(int index, char *data, int flags)
compile a regex, perform the search and record index
Definition: nomos_regex.c:274
void regexError(int ret, regex_t *regc, char *regex)
Log an error caused by regex.
Definition: nomos_regex.c:49