156088Sbostic /*- 256088Sbostic * Copyright (c) 1992 Henry Spencer. 361068Sbostic * Copyright (c) 1992, 1993 461068Sbostic * The Regents of the University of California. All rights reserved. 556088Sbostic * 656088Sbostic * This code is derived from software contributed to Berkeley by 756088Sbostic * Henry Spencer of the University of Toronto. 856088Sbostic * 956088Sbostic * %sccs.include.redist.c% 1056088Sbostic * 11*65373Sbostic * @(#)regex.h 8.2 (Berkeley) 01/03/94 1256088Sbostic */ 1356088Sbostic 1456088Sbostic #ifndef _REGEX_H_ 1556088Sbostic #define _REGEX_H_ 1656088Sbostic 1760612Sbostic #include <sys/cdefs.h> 1860612Sbostic 1956088Sbostic /* types */ 2056088Sbostic typedef off_t regoff_t; 2156088Sbostic 2256088Sbostic typedef struct { 2356088Sbostic int re_magic; 2456088Sbostic size_t re_nsub; /* number of parenthesized subexpressions */ 25*65373Sbostic __const char *re_endp; /* end pointer for REG_PEND */ 2656088Sbostic struct re_guts *re_g; /* none of your business :-) */ 2756088Sbostic } regex_t; 2856088Sbostic 2956088Sbostic typedef struct { 3056088Sbostic regoff_t rm_so; /* start of match */ 3156088Sbostic regoff_t rm_eo; /* end of match */ 3256088Sbostic } regmatch_t; 3356088Sbostic 3456088Sbostic /* regcomp() flags */ 3560185Sbostic #define REG_BASIC 0000 3660185Sbostic #define REG_EXTENDED 0001 3760185Sbostic #define REG_ICASE 0002 3860185Sbostic #define REG_NOSUB 0004 3960185Sbostic #define REG_NEWLINE 0010 4060185Sbostic #define REG_NOSPEC 0020 4160185Sbostic #define REG_PEND 0040 4260185Sbostic #define REG_DUMP 0200 4356088Sbostic 4460185Sbostic /* regerror() flags */ 4560185Sbostic #define REG_NOMATCH 1 4660185Sbostic #define REG_BADPAT 2 4760185Sbostic #define REG_ECOLLATE 3 4860185Sbostic #define REG_ECTYPE 4 4960185Sbostic #define REG_EESCAPE 5 5060185Sbostic #define REG_ESUBREG 6 5160185Sbostic #define REG_EBRACK 7 5260185Sbostic #define REG_EPAREN 8 5360185Sbostic #define REG_EBRACE 9 5460185Sbostic #define REG_BADBR 10 5560185Sbostic #define REG_ERANGE 11 5660185Sbostic #define REG_ESPACE 12 5760185Sbostic #define REG_BADRPT 13 5860185Sbostic #define REG_EMPTY 14 5960185Sbostic #define REG_ASSERT 15 6060185Sbostic #define REG_INVARG 16 6160185Sbostic #define REG_ATOI 255 /* convert name to number (!) */ 6260185Sbostic #define REG_ITOA 0400 /* convert number to name (!) */ 6360185Sbostic 6456088Sbostic /* regexec() flags */ 6556088Sbostic #define REG_NOTBOL 00001 6656088Sbostic #define REG_NOTEOL 00002 6756088Sbostic #define REG_STARTEND 00004 6860185Sbostic #define REG_TRACE 00400 /* tracing of execution */ 6960185Sbostic #define REG_LARGE 01000 /* force large representation */ 7060185Sbostic #define REG_BACKR 02000 /* force use of backref code */ 7156088Sbostic 7256358Sbostic __BEGIN_DECLS 7356358Sbostic int regcomp __P((regex_t *, const char *, int)); 7456358Sbostic size_t regerror __P((int, const regex_t *, char *, size_t)); 7556358Sbostic int regexec __P((const regex_t *, 7656358Sbostic const char *, size_t, regmatch_t [], int)); 7756358Sbostic void regfree __P((regex_t *)); 7856358Sbostic __END_DECLS 7956358Sbostic 8056088Sbostic #endif /* !_REGEX_H_ */ 81