14fa7b105644222d9b35347c9d226ca8e011072ebColin Cross/* $OpenBSD: regex.h,v 1.6 2003/06/02 19:34:12 millert Exp $ */ 24fa7b105644222d9b35347c9d226ca8e011072ebColin Cross/* $NetBSD: regex.h,v 1.4.6.1 1996/06/10 18:57:07 explorer Exp $ */ 34fa7b105644222d9b35347c9d226ca8e011072ebColin Cross 44fa7b105644222d9b35347c9d226ca8e011072ebColin Cross/*- 54fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * Copyright (c) 1992 Henry Spencer. 64fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * Copyright (c) 1992, 1993 74fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * The Regents of the University of California. All rights reserved. 84fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * 94fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * This code is derived from software contributed to Berkeley by 104fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * Henry Spencer of the University of Toronto. 114fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * 124fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * Redistribution and use in source and binary forms, with or without 134fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * modification, are permitted provided that the following conditions 144fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * are met: 154fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * 1. Redistributions of source code must retain the above copyright 164fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * notice, this list of conditions and the following disclaimer. 174fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * 2. Redistributions in binary form must reproduce the above copyright 184fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * notice, this list of conditions and the following disclaimer in the 194fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * documentation and/or other materials provided with the distribution. 204fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * 3. Neither the name of the University nor the names of its contributors 214fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * may be used to endorse or promote products derived from this software 224fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * without specific prior written permission. 234fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * 244fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 254fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 264fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 274fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 284fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 294fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 304fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 314fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 324fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 334fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 344fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * SUCH DAMAGE. 354fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * 364fa7b105644222d9b35347c9d226ca8e011072ebColin Cross * @(#)regex.h 8.1 (Berkeley) 6/2/93 374fa7b105644222d9b35347c9d226ca8e011072ebColin Cross */ 384fa7b105644222d9b35347c9d226ca8e011072ebColin Cross 394fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#ifndef _REGEX_H_ 404fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define _REGEX_H_ 414fa7b105644222d9b35347c9d226ca8e011072ebColin Cross 424fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#include <sys/cdefs.h> 434fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#include <sys/types.h> 444fa7b105644222d9b35347c9d226ca8e011072ebColin Cross 454fa7b105644222d9b35347c9d226ca8e011072ebColin Cross/* types */ 464fa7b105644222d9b35347c9d226ca8e011072ebColin Crosstypedef off_t regoff_t; 474fa7b105644222d9b35347c9d226ca8e011072ebColin Cross 484fa7b105644222d9b35347c9d226ca8e011072ebColin Crosstypedef struct { 494fa7b105644222d9b35347c9d226ca8e011072ebColin Cross int re_magic; 504fa7b105644222d9b35347c9d226ca8e011072ebColin Cross size_t re_nsub; /* number of parenthesized subexpressions */ 514fa7b105644222d9b35347c9d226ca8e011072ebColin Cross const char *re_endp; /* end pointer for REG_PEND */ 524fa7b105644222d9b35347c9d226ca8e011072ebColin Cross struct re_guts *re_g; /* none of your business :-) */ 534fa7b105644222d9b35347c9d226ca8e011072ebColin Cross} regex_t; 544fa7b105644222d9b35347c9d226ca8e011072ebColin Cross 554fa7b105644222d9b35347c9d226ca8e011072ebColin Crosstypedef struct { 564fa7b105644222d9b35347c9d226ca8e011072ebColin Cross regoff_t rm_so; /* start of match */ 574fa7b105644222d9b35347c9d226ca8e011072ebColin Cross regoff_t rm_eo; /* end of match */ 584fa7b105644222d9b35347c9d226ca8e011072ebColin Cross} regmatch_t; 594fa7b105644222d9b35347c9d226ca8e011072ebColin Cross 604fa7b105644222d9b35347c9d226ca8e011072ebColin Cross/* regcomp() flags */ 614fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_BASIC 0000 624fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_EXTENDED 0001 634fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_ICASE 0002 644fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_NOSUB 0004 654fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_NEWLINE 0010 664fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_NOSPEC 0020 674fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_PEND 0040 684fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_DUMP 0200 694fa7b105644222d9b35347c9d226ca8e011072ebColin Cross 704fa7b105644222d9b35347c9d226ca8e011072ebColin Cross/* regerror() flags */ 714fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_NOMATCH 1 724fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_BADPAT 2 734fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_ECOLLATE 3 744fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_ECTYPE 4 754fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_EESCAPE 5 764fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_ESUBREG 6 774fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_EBRACK 7 784fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_EPAREN 8 794fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_EBRACE 9 804fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_BADBR 10 814fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_ERANGE 11 824fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_ESPACE 12 834fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_BADRPT 13 844fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_EMPTY 14 854fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_ASSERT 15 864fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_INVARG 16 874fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_ATOI 255 /* convert name to number (!) */ 884fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_ITOA 0400 /* convert number to name (!) */ 894fa7b105644222d9b35347c9d226ca8e011072ebColin Cross 904fa7b105644222d9b35347c9d226ca8e011072ebColin Cross/* regexec() flags */ 914fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_NOTBOL 00001 924fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_NOTEOL 00002 934fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_STARTEND 00004 944fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_TRACE 00400 /* tracing of execution */ 954fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_LARGE 01000 /* force large representation */ 964fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#define REG_BACKR 02000 /* force use of backref code */ 974fa7b105644222d9b35347c9d226ca8e011072ebColin Cross 984fa7b105644222d9b35347c9d226ca8e011072ebColin Cross__BEGIN_DECLS 994fa7b105644222d9b35347c9d226ca8e011072ebColin Crossint regcomp(regex_t *, const char *, int); 1004fa7b105644222d9b35347c9d226ca8e011072ebColin Crosssize_t regerror(int, const regex_t *, char *, size_t); 1014fa7b105644222d9b35347c9d226ca8e011072ebColin Crossint regexec(const regex_t *, const char *, size_t, regmatch_t [], int); 1024fa7b105644222d9b35347c9d226ca8e011072ebColin Crossvoid regfree(regex_t *); 1034fa7b105644222d9b35347c9d226ca8e011072ebColin Cross__END_DECLS 1044fa7b105644222d9b35347c9d226ca8e011072ebColin Cross 1054fa7b105644222d9b35347c9d226ca8e011072ebColin Cross#endif /* !_REGEX_H_ */ 106