xref: /netbsd-src/include/regexp.h (revision 19b7469a00774db6388c6a13f555d2fd58994b47)
1*19b7469aSperry /*	$NetBSD: regexp.h,v 1.7 2005/02/03 04:39:32 perry Exp $	*/
2039cc956Sagc 
3039cc956Sagc /*
4039cc956Sagc  * Copyright (c) 1989, 1993
5039cc956Sagc  *	The Regents of the University of California.  All rights reserved.
6039cc956Sagc  *
7039cc956Sagc  * This code is derived from software contributed to Berkeley
8039cc956Sagc  * by Henry Spencer.
9039cc956Sagc  *
10039cc956Sagc  * Redistribution and use in source and binary forms, with or without
11039cc956Sagc  * modification, are permitted provided that the following conditions
12039cc956Sagc  * are met:
13039cc956Sagc  * 1. Redistributions of source code must retain the above copyright
14039cc956Sagc  *    notice, this list of conditions and the following disclaimer.
15039cc956Sagc  * 2. Redistributions in binary form must reproduce the above copyright
16039cc956Sagc  *    notice, this list of conditions and the following disclaimer in the
17039cc956Sagc  *    documentation and/or other materials provided with the distribution.
18039cc956Sagc  * 3. Neither the name of the University nor the names of its contributors
19039cc956Sagc  *    may be used to endorse or promote products derived from this software
20039cc956Sagc  *    without specific prior written permission.
21039cc956Sagc  *
22039cc956Sagc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23039cc956Sagc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24039cc956Sagc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25039cc956Sagc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26039cc956Sagc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27039cc956Sagc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28039cc956Sagc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29039cc956Sagc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30039cc956Sagc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31039cc956Sagc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32039cc956Sagc  * SUCH DAMAGE.
33039cc956Sagc  *
34039cc956Sagc  *	@(#)regexp.h	8.1 (Berkeley) 6/2/93
35039cc956Sagc  */
364d2cbfceScgd 
3761f28255Scgd /*
3861f28255Scgd  * Copyright (c) 1986 by University of Toronto.
3961f28255Scgd  *
4061f28255Scgd  * This code is derived from software contributed to Berkeley
4161f28255Scgd  * by Henry Spencer.
4261f28255Scgd  *
4361f28255Scgd  * Redistribution and use in source and binary forms, with or without
4461f28255Scgd  * modification, are permitted provided that the following conditions
4561f28255Scgd  * are met:
4661f28255Scgd  * 1. Redistributions of source code must retain the above copyright
4761f28255Scgd  *    notice, this list of conditions and the following disclaimer.
4861f28255Scgd  * 2. Redistributions in binary form must reproduce the above copyright
4961f28255Scgd  *    notice, this list of conditions and the following disclaimer in the
5061f28255Scgd  *    documentation and/or other materials provided with the distribution.
5161f28255Scgd  * 3. All advertising materials mentioning features or use of this software
5261f28255Scgd  *    must display the following acknowledgement:
5361f28255Scgd  *	This product includes software developed by the University of
5461f28255Scgd  *	California, Berkeley and its contributors.
5561f28255Scgd  * 4. Neither the name of the University nor the names of its contributors
5661f28255Scgd  *    may be used to endorse or promote products derived from this software
5761f28255Scgd  *    without specific prior written permission.
5861f28255Scgd  *
5961f28255Scgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
6061f28255Scgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
6161f28255Scgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
6261f28255Scgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
6361f28255Scgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
6461f28255Scgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
6561f28255Scgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
6661f28255Scgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
6761f28255Scgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
6861f28255Scgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
6961f28255Scgd  * SUCH DAMAGE.
7061f28255Scgd  *
71b7b7322cSperry  *	@(#)regexp.h	8.1 (Berkeley) 6/2/93
7261f28255Scgd  */
7361f28255Scgd 
7461f28255Scgd #ifndef	_REGEXP_H_
7561f28255Scgd #define	_REGEXP_H_
7661f28255Scgd 
7761f28255Scgd /*
7861f28255Scgd  * Definitions etc. for regexp(3) routines.
7961f28255Scgd  *
8061f28255Scgd  * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
8161f28255Scgd  * not the System V one.
8261f28255Scgd  */
8361f28255Scgd #define NSUBEXP  10
8461f28255Scgd typedef struct regexp {
8561f28255Scgd 	char *startp[NSUBEXP];
8661f28255Scgd 	char *endp[NSUBEXP];
8761f28255Scgd 	char regstart;		/* Internal use only. */
8861f28255Scgd 	char reganch;		/* Internal use only. */
8961f28255Scgd 	char *regmust;		/* Internal use only. */
9061f28255Scgd 	int regmlen;		/* Internal use only. */
9161f28255Scgd 	char program[1];	/* Unwarranted chumminess with compiler. */
9261f28255Scgd } regexp;
9361f28255Scgd 
9461f28255Scgd #include <sys/cdefs.h>
9561f28255Scgd 
9661f28255Scgd __BEGIN_DECLS
975426fd27Stv #ifdef __LIBCOMPAT_SOURCE__
98*19b7469aSperry regexp *__compat_regcomp(const char *);
99*19b7469aSperry int __compat_regexec(const  regexp *, const char *);
100*19b7469aSperry void __compat_regsub(const  regexp *, const char *, char *);
101*19b7469aSperry void __compat_regerror(const char *);
1025426fd27Stv #endif
103*19b7469aSperry regexp *regcomp(const char *) __RENAME(__compat_regcomp);
104*19b7469aSperry int regexec(const  regexp *, const char *) __RENAME(__compat_regexec);
105*19b7469aSperry void regsub(const  regexp *, const char *, char *) __RENAME(__compat_regsub);
106*19b7469aSperry void regerror(const char *) __RENAME(__compat_regerror);
10761f28255Scgd __END_DECLS
10861f28255Scgd 
10961f28255Scgd #endif /* !_REGEXP_H_ */
110