00001 00002 #ifndef _REGEX_H_ 00003 #define _REGEX_H_ 00004 00005 #include <sys/cdefs.h> 00006 #include <sys/types.h> 00007 00008 /* types */ 00009 typedef off_t regoff_t; 00010 00011 typedef struct { 00012 int re_magic; 00013 size_t re_nsub; /* number of parenthesized subexpressions */ 00014 const char *re_endp; /* end pointer for REG_PEND */ 00015 struct re_guts *re_g; /* none of your business :-) */ 00016 } regex_t; 00017 00018 typedef struct { 00019 regoff_t rm_so; /* start of match */ 00020 regoff_t rm_eo; /* end of match */ 00021 } regmatch_t; 00022 00023 /* regcomp() flags */ 00024 #define REG_BASIC 0000 00025 #define REG_EXTENDED 0001 00026 #define REG_ICASE 0002 00027 #define REG_NOSUB 0004 00028 #define REG_NEWLINE 0010 00029 #define REG_NOSPEC 0020 00030 #define REG_PEND 0040 00031 #define REG_DUMP 0200 00032 00033 /* regerror() flags */ 00034 #define REG_NOMATCH 1 00035 #define REG_BADPAT 2 00036 #define REG_ECOLLATE 3 00037 #define REG_ECTYPE 4 00038 #define REG_EESCAPE 5 00039 #define REG_ESUBREG 6 00040 #define REG_EBRACK 7 00041 #define REG_EPAREN 8 00042 #define REG_EBRACE 9 00043 #define REG_BADBR 10 00044 #define REG_ERANGE 11 00045 #define REG_ESPACE 12 00046 #define REG_BADRPT 13 00047 #define REG_EMPTY 14 00048 #define REG_ASSERT 15 00049 #define REG_INVARG 16 00050 #define REG_ENOSYS 17 00051 #define REG_ATOI 255 /* convert name to number (!) */ 00052 #define REG_ITOA 0400 /* convert number to name (!) */ 00053 00054 /* regexec() flags */ 00055 #define REG_NOTBOL 00001 00056 #define REG_NOTEOL 00002 00057 #define REG_STARTEND 00004 00058 #define REG_TRACE 00400 /* tracing of execution */ 00059 #define REG_LARGE 01000 /* force large representation */ 00060 #define REG_BACKR 02000 /* force use of backref code */ 00061 00062 int regcomp(regex_t * __restrict, const char * __restrict, int); 00063 size_t regerror(int, const regex_t * __restrict, char * __restrict, size_t); 00064 int regexec(const regex_t * __restrict, 00065 const char * __restrict, size_t, regmatch_t [], int); 00066 void regfree(regex_t *); 00067 00068 #endif /* !_REGEX_H_ */