• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _REGEX_H_
2 #define _REGEX_H_
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include <sys/types.h>
9 
10 typedef off_t regoff_t;
11 
12 typedef struct {
13 	int re_magic;
14 	size_t re_nsub;		/* number of parenthesized subexpressions */
15 	const char *re_endp;	/* end pointer for REG_PEND */
16 	struct re_guts *re_g;	/* none of your business :-) */
17 } regex_t;
18 
19 typedef struct {
20 	regoff_t rm_so;		/* start of match */
21 	regoff_t rm_eo;		/* end of match */
22 } regmatch_t;
23 
24 extern int regcomp(regex_t *, const char *, int);
25 extern size_t regerror(int, const regex_t *, char *, size_t);
26 extern int regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
27 extern void regfree(regex_t *);
28 
29 #define	REG_BASIC	0000
30 #define	REG_EXTENDED	0001
31 #define	REG_ICASE	0002
32 #define	REG_NOSUB	0004
33 #define	REG_NEWLINE	0010
34 #define	REG_NOSPEC	0020
35 #define	REG_PEND	0040
36 #define	REG_OKAY	 0
37 #define	REG_NOMATCH	 1
38 #define	REG_BADPAT	 2
39 #define	REG_ECOLLATE	 3
40 #define	REG_ECTYPE	 4
41 #define	REG_EESCAPE	 5
42 #define	REG_ESUBREG	 6
43 #define	REG_EBRACK	 7
44 #define	REG_EPAREN	 8
45 #define	REG_EBRACE	 9
46 #define	REG_BADBR	10
47 #define	REG_ERANGE	11
48 #define	REG_ESPACE	12
49 #define	REG_BADRPT	13
50 #define	REG_EMPTY	14
51 #define	REG_ASSERT	15
52 #define	REG_INVARG	16
53 #define	REG_ATOI	255	/* convert name to number (!) */
54 #define	REG_ITOA	0400	/* convert number to name (!) */
55 #define	REG_NOTBOL	00001
56 #define	REG_NOTEOL	00002
57 #define	REG_STARTEND	00004
58 #define	REG_TRACE	00400	/* tracing of execution */
59 #define	REG_LARGE	01000	/* force large representation */
60 #define	REG_BACKR	02000	/* force use of backref code */
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 #endif
66