xref: /netbsd-src/include/regexp.h (revision 19b7469a00774db6388c6a13f555d2fd58994b47)
1 /*	$NetBSD: regexp.h,v 1.7 2005/02/03 04:39:32 perry Exp $	*/
2 
3 /*
4  * Copyright (c) 1989, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley
8  * by Henry Spencer.
9  *
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.
21  *
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.
33  *
34  *	@(#)regexp.h	8.1 (Berkeley) 6/2/93
35  */
36 
37 /*
38  * Copyright (c) 1986 by University of Toronto.
39  *
40  * This code is derived from software contributed to Berkeley
41  * by Henry Spencer.
42  *
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.
58  *
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.
70  *
71  *	@(#)regexp.h	8.1 (Berkeley) 6/2/93
72  */
73 
74 #ifndef	_REGEXP_H_
75 #define	_REGEXP_H_
76 
77 /*
78  * Definitions etc. for regexp(3) routines.
79  *
80  * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
81  * not the System V one.
82  */
83 #define NSUBEXP  10
84 typedef struct regexp {
85 	char *startp[NSUBEXP];
86 	char *endp[NSUBEXP];
87 	char regstart;		/* Internal use only. */
88 	char reganch;		/* Internal use only. */
89 	char *regmust;		/* Internal use only. */
90 	int regmlen;		/* Internal use only. */
91 	char program[1];	/* Unwarranted chumminess with compiler. */
92 } regexp;
93 
94 #include <sys/cdefs.h>
95 
96 __BEGIN_DECLS
97 #ifdef __LIBCOMPAT_SOURCE__
98 regexp *__compat_regcomp(const char *);
99 int __compat_regexec(const  regexp *, const char *);
100 void __compat_regsub(const  regexp *, const char *, char *);
101 void __compat_regerror(const char *);
102 #endif
103 regexp *regcomp(const char *) __RENAME(__compat_regcomp);
104 int regexec(const  regexp *, const char *) __RENAME(__compat_regexec);
105 void regsub(const  regexp *, const char *, char *) __RENAME(__compat_regsub);
106 void regerror(const char *) __RENAME(__compat_regerror);
107 __END_DECLS
108 
109 #endif /* !_REGEXP_H_ */
110