blob: d57208a561e66a74129c63076bad599df2d567bf [file] [log] [blame]
Rich Felker0b44a032011-02-12 00:22:29 -05001#ifndef _REGEX_H
2#define _REGEX_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#define __NEED_size_t
9
10#include <bits/alltypes.h>
11
12typedef long regoff_t;
13
14typedef struct {
15 size_t re_nsub;
Rich Felker32aea202011-06-16 16:53:11 -040016 void *__opaque, *__padding[4];
17 size_t __nsub2;
Rich Felker0b44a032011-02-12 00:22:29 -050018} regex_t;
19
20typedef struct {
21 regoff_t rm_so;
22 regoff_t rm_eo;
23} regmatch_t;
24
25#define REG_EXTENDED 1
26#define REG_ICASE 2
27#define REG_NEWLINE 4
28#define REG_NOSUB 8
29
30#define REG_NOTBOL 1
31#define REG_NOTEOL 2
32
33#define REG_OK 0
34#define REG_NOMATCH 1
35#define REG_BADPAT 2
36#define REG_ECOLLATE 3
37#define REG_ECTYPE 4
38#define REG_EESCAPE 5
39#define REG_ESUBREG 6
40#define REG_EBRACK 7
41#define REG_EPAREN 8
42#define REG_EBRACE 9
43#define REG_BADBR 10
44#define REG_ERANGE 11
45#define REG_ESPACE 12
46#define REG_BADRPT 13
47
48#define REG_ENOSYS -1
49
50int regcomp(regex_t *, const char *, int);
51int regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
52void regfree(regex_t *);
53
54size_t regerror(int, const regex_t *, char *, size_t);
55
56#ifdef __cplusplus
57}
58#endif
59
60#endif