1 /*- 2 * Copyright (c) 1992 Henry Spencer. 3 * Copyright (c) 1992 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Henry Spencer of the University of Toronto. 8 * 9 * %sccs.include.redist.c% 10 * 11 * @(#)regex.h 5.2 (Berkeley) 09/30/92 12 */ 13 14 #ifndef _REGEX_H_ 15 #define _REGEX_H_ 16 17 /* types */ 18 typedef off_t regoff_t; 19 20 typedef struct { 21 int re_magic; 22 size_t re_nsub; /* number of parenthesized subexpressions */ 23 struct re_guts *re_g; /* none of your business :-) */ 24 } regex_t; 25 26 typedef struct { 27 regoff_t rm_so; /* start of match */ 28 regoff_t rm_eo; /* end of match */ 29 } regmatch_t; 30 31 /* regcomp() flags */ 32 #define REG_EXTENDED 001 33 #define REG_ICASE 002 34 #define REG_NOSUB 004 35 #define REG_NEWLINE 010 36 37 /* regexec() flags */ 38 #define REG_NOTBOL 00001 39 #define REG_NOTEOL 00002 40 #define REG_STARTEND 00004 41 #define REG_TRACE 00400 /* debugging tracing */ 42 #define REG_LARGE 01000 /* force large state model for debug */ 43 #define REG_BACKR 02000 44 45 /* errors */ 46 #define REG_NOMATCH (1) 47 #define REG_BADPAT (2) 48 #define REG_ECOLLATE (3) 49 #define REG_ECTYPE (4) 50 #define REG_EESCAPE (5) 51 #define REG_ESUBREG (6) 52 #define REG_EBRACK (7) 53 #define REG_EPAREN (8) 54 #define REG_EBRACE (9) 55 #define REG_BADBR (10) 56 #define REG_ERANGE (11) 57 #define REG_ESPACE (12) 58 #define REG_BADRPT (13) 59 #define REG_EMPTY (14) /* empty component */ 60 #define REG_ASSERT (15) /* assertion failure */ 61 62 #include <sys/cdefs.h> 63 64 __BEGIN_DECLS 65 int regcomp __P((regex_t *, const char *, int)); 66 size_t regerror __P((int, const regex_t *, char *, size_t)); 67 int regexec __P((const regex_t *, 68 const char *, size_t, regmatch_t [], int)); 69 void regfree __P((regex_t *)); 70 __END_DECLS 71 72 #endif /* !_REGEX_H_ */ 73