No empty .Rs/.Re
[netbsd-mini2440.git] / include / regex.h
bloba17b0798c9d6d14510b1fdc39aa8f3c1b8c5ce42
1 /* $NetBSD: regex.h,v 1.12 2005/02/03 04:39:32 perry Exp $ */
3 /*-
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
8 * Henry Spencer of the University of Toronto.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
34 * @(#)regex.h 8.2 (Berkeley) 1/3/94
37 /*-
38 * Copyright (c) 1992 Henry Spencer.
40 * This code is derived from software contributed to Berkeley by
41 * Henry Spencer of the University of Toronto.
43 * Redistribution and use in source and binary forms, with or without
44 * modification, are permitted provided that the following conditions
45 * are met:
46 * 1. Redistributions of source code must retain the above copyright
47 * notice, this list of conditions and the following disclaimer.
48 * 2. Redistributions in binary form must reproduce the above copyright
49 * notice, this list of conditions and the following disclaimer in the
50 * documentation and/or other materials provided with the distribution.
51 * 3. All advertising materials mentioning features or use of this software
52 * must display the following acknowledgement:
53 * This product includes software developed by the University of
54 * California, Berkeley and its contributors.
55 * 4. Neither the name of the University nor the names of its contributors
56 * may be used to endorse or promote products derived from this software
57 * without specific prior written permission.
59 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
60 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
61 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
62 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
63 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
64 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69 * SUCH DAMAGE.
71 * @(#)regex.h 8.2 (Berkeley) 1/3/94
74 #ifndef _REGEX_H_
75 #define _REGEX_H_
77 #include <sys/cdefs.h>
78 #include <sys/types.h>
80 /* types */
81 typedef off_t regoff_t;
83 typedef struct {
84 int re_magic;
85 size_t re_nsub; /* number of parenthesized subexpressions */
86 const char *re_endp; /* end pointer for REG_PEND */
87 struct re_guts *re_g; /* none of your business :-) */
88 } regex_t;
90 typedef struct {
91 regoff_t rm_so; /* start of match */
92 regoff_t rm_eo; /* end of match */
93 } regmatch_t;
95 /* regcomp() flags */
96 #define REG_BASIC 0000
97 #define REG_EXTENDED 0001
98 #define REG_ICASE 0002
99 #define REG_NOSUB 0004
100 #define REG_NEWLINE 0010
101 #define REG_NOSPEC 0020
102 #define REG_PEND 0040
103 #define REG_DUMP 0200
105 /* regerror() flags */
106 #define REG_NOMATCH 1
107 #define REG_BADPAT 2
108 #define REG_ECOLLATE 3
109 #define REG_ECTYPE 4
110 #define REG_EESCAPE 5
111 #define REG_ESUBREG 6
112 #define REG_EBRACK 7
113 #define REG_EPAREN 8
114 #define REG_EBRACE 9
115 #define REG_BADBR 10
116 #define REG_ERANGE 11
117 #define REG_ESPACE 12
118 #define REG_BADRPT 13
119 #define REG_EMPTY 14
120 #define REG_ASSERT 15
121 #define REG_INVARG 16
122 #define REG_ENOSYS 17
123 #define REG_ATOI 255 /* convert name to number (!) */
124 #define REG_ITOA 0400 /* convert number to name (!) */
126 /* regexec() flags */
127 #define REG_NOTBOL 00001
128 #define REG_NOTEOL 00002
129 #define REG_STARTEND 00004
130 #define REG_TRACE 00400 /* tracing of execution */
131 #define REG_LARGE 01000 /* force large representation */
132 #define REG_BACKR 02000 /* force use of backref code */
134 __BEGIN_DECLS
135 int regcomp(regex_t * __restrict, const char * __restrict, int);
136 size_t regerror(int, const regex_t * __restrict, char * __restrict, size_t);
137 int regexec(const regex_t * __restrict,
138 const char * __restrict, size_t, regmatch_t [], int);
139 void regfree(regex_t *);
140 __END_DECLS
142 #endif /* !_REGEX_H_ */