regex.h revision 93032
11539Srgrimes/*- 21539Srgrimes * Copyright (c) 1992 Henry Spencer. 31539Srgrimes * Copyright (c) 1992, 1993 41539Srgrimes * The Regents of the University of California. All rights reserved. 51539Srgrimes * 61539Srgrimes * This code is derived from software contributed to Berkeley by 71539Srgrimes * Henry Spencer of the University of Toronto. 81539Srgrimes * 91539Srgrimes * Redistribution and use in source and binary forms, with or without 101539Srgrimes * modification, are permitted provided that the following conditions 111539Srgrimes * are met: 121539Srgrimes * 1. Redistributions of source code must retain the above copyright 131539Srgrimes * notice, this list of conditions and the following disclaimer. 141539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 151539Srgrimes * notice, this list of conditions and the following disclaimer in the 161539Srgrimes * documentation and/or other materials provided with the distribution. 171539Srgrimes * 3. All advertising materials mentioning features or use of this software 181539Srgrimes * must display the following acknowledgement: 191539Srgrimes * This product includes software developed by the University of 201539Srgrimes * California, Berkeley and its contributors. 211539Srgrimes * 4. Neither the name of the University nor the names of its contributors 221539Srgrimes * may be used to endorse or promote products derived from this software 231539Srgrimes * without specific prior written permission. 241539Srgrimes * 251539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 261539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 271539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 281539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 291539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 301539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 311539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 321539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 331539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 341539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 351539Srgrimes * SUCH DAMAGE. 361539Srgrimes * 371539Srgrimes * @(#)regex.h 8.2 (Berkeley) 1/3/94 3893032Simp * $FreeBSD: head/include/regex.h 93032 2002-03-23 17:24:55Z imp $ 391539Srgrimes */ 401539Srgrimes 411539Srgrimes#ifndef _REGEX_H_ 421539Srgrimes#define _REGEX_H_ 431539Srgrimes 441539Srgrimes#include <sys/cdefs.h> 451539Srgrimes 461539Srgrimes/* types */ 471539Srgrimestypedef off_t regoff_t; 481539Srgrimes 491539Srgrimestypedef struct { 501539Srgrimes int re_magic; 511539Srgrimes size_t re_nsub; /* number of parenthesized subexpressions */ 521539Srgrimes __const char *re_endp; /* end pointer for REG_PEND */ 531539Srgrimes struct re_guts *re_g; /* none of your business :-) */ 541539Srgrimes} regex_t; 551539Srgrimes 561539Srgrimestypedef struct { 571539Srgrimes regoff_t rm_so; /* start of match */ 581539Srgrimes regoff_t rm_eo; /* end of match */ 591539Srgrimes} regmatch_t; 601539Srgrimes 611539Srgrimes/* regcomp() flags */ 621539Srgrimes#define REG_BASIC 0000 631539Srgrimes#define REG_EXTENDED 0001 641539Srgrimes#define REG_ICASE 0002 651539Srgrimes#define REG_NOSUB 0004 661539Srgrimes#define REG_NEWLINE 0010 671539Srgrimes#define REG_NOSPEC 0020 681539Srgrimes#define REG_PEND 0040 691539Srgrimes#define REG_DUMP 0200 701539Srgrimes 711539Srgrimes/* regerror() flags */ 721539Srgrimes#define REG_NOMATCH 1 731539Srgrimes#define REG_BADPAT 2 741539Srgrimes#define REG_ECOLLATE 3 751539Srgrimes#define REG_ECTYPE 4 761539Srgrimes#define REG_EESCAPE 5 771539Srgrimes#define REG_ESUBREG 6 781539Srgrimes#define REG_EBRACK 7 791539Srgrimes#define REG_EPAREN 8 801539Srgrimes#define REG_EBRACE 9 811539Srgrimes#define REG_BADBR 10 821539Srgrimes#define REG_ERANGE 11 831539Srgrimes#define REG_ESPACE 12 841539Srgrimes#define REG_BADRPT 13 851539Srgrimes#define REG_EMPTY 14 861539Srgrimes#define REG_ASSERT 15 871539Srgrimes#define REG_INVARG 16 881539Srgrimes#define REG_ATOI 255 /* convert name to number (!) */ 891539Srgrimes#define REG_ITOA 0400 /* convert number to name (!) */ 901539Srgrimes 911539Srgrimes/* regexec() flags */ 921539Srgrimes#define REG_NOTBOL 00001 931539Srgrimes#define REG_NOTEOL 00002 941539Srgrimes#define REG_STARTEND 00004 951539Srgrimes#define REG_TRACE 00400 /* tracing of execution */ 961539Srgrimes#define REG_LARGE 01000 /* force large representation */ 971539Srgrimes#define REG_BACKR 02000 /* force use of backref code */ 981539Srgrimes 991539Srgrimes__BEGIN_DECLS 10093032Simpint regcomp(regex_t *, const char *, int); 10193032Simpsize_t regerror(int, const regex_t *, char *, size_t); 10293032Simpint regexec(const regex_t *, const char *, size_t, regmatch_t [], int); 10393032Simpvoid regfree(regex_t *); 1041539Srgrimes__END_DECLS 1051539Srgrimes 1061539Srgrimes#endif /* !_REGEX_H_ */ 107