From 268b8c4f387b9019bbb3591fb07403925d55d0c5 Mon Sep 17 00:00:00 2001 From: Mark Whitley Date: Wed, 28 Jun 2000 21:59:31 +0000 Subject: Moved some function decls, a struct, and a #define from regexp.h into here. Also static-ified said functions so they do not have namespace conflicts with the libc regex functions. --- regexp.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'regexp.c') diff --git a/regexp.c b/regexp.c index c271412cb..6fedb01ba 100644 --- a/regexp.c +++ b/regexp.c @@ -8,6 +8,21 @@ #include +#define NSUBEXP 10 +typedef struct regexp { + char *startp[NSUBEXP]; + char *endp[NSUBEXP]; + int minlen; /* length of shortest possible match */ + char first; /* first character, if known; else \0 */ + char bol; /* boolean: must start at beginning of line? */ + char program[1]; /* Unwarranted chumminess with compiler. */ +} regexp; + + +static regexp *regcomp(char* text); +static int regexec(struct regexp* re, char* str, int bol, int ignoreCase); +static void regsub(struct regexp* re, char* src, char* dst); + #if ( defined BB_GREP || defined BB_SED) /* This also tries to find a needle in a haystack, but uses @@ -467,7 +482,7 @@ static int match(regexp * re, char *str, char *prog, char *here, /* This function compiles a regexp. */ -extern regexp *regcomp(char *text) +static regexp *regcomp(char *text) { int needfirst; unsigned size; @@ -595,7 +610,7 @@ extern regexp *regcomp(char *text) /* str -- the string to search through */ /* bol -- does str start at the beginning of a line? (boolean) */ /* ignoreCase -- ignoreCase or not */ -extern int regexec(struct regexp *re, char *str, int bol, int ignoreCase) +static int regexec(struct regexp *re, char *str, int bol, int ignoreCase) { char *prog; /* the entry point of re->program */ int len; /* length of the string */ @@ -644,7 +659,7 @@ extern int regexec(struct regexp *re, char *str, int bol, int ignoreCase) #if defined BB_SED /* This performs substitutions after a regexp match has been found. */ -extern void regsub(regexp * re, char *src, char *dst) +static void regsub(regexp * re, char *src, char *dst) { char *cpy; char *end; -- cgit v1.2.3