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