diff options
Diffstat (limited to 'lib/libcompat/regexp/regexp.c')
-rw-r--r-- | lib/libcompat/regexp/regexp.c | 116 |
1 files changed, 60 insertions, 56 deletions
diff --git a/lib/libcompat/regexp/regexp.c b/lib/libcompat/regexp/regexp.c index fc97378..8276ffc 100644 --- a/lib/libcompat/regexp/regexp.c +++ b/lib/libcompat/regexp/regexp.c @@ -32,6 +32,10 @@ * precedence is structured in regular expressions. Serious changes in * regular-expression syntax might require a total rethink. */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + #include <limits.h> #include <regexp.h> #include <stdio.h> @@ -205,10 +209,10 @@ regexp * regcomp(exp) const char *exp; { - register regexp *r; - register char *scan; - register char *longest; - register int len; + regexp *r; + char *scan; + char *longest; + int len; int flags; if (exp == NULL) @@ -296,10 +300,10 @@ reg(paren, flagp) int paren; /* Parenthesized? */ int *flagp; { - register char *ret; - register char *br; - register char *ender; - register int parno; + char *ret; + char *br; + char *ender; + int parno; int flags; *flagp = HASWIDTH; /* Tentatively. */ @@ -367,9 +371,9 @@ static char * regbranch(flagp) int *flagp; { - register char *ret; - register char *chain; - register char *latest; + char *ret; + char *chain; + char *latest; int flags; *flagp = WORST; /* Tentatively. */ @@ -407,9 +411,9 @@ static char * regpiece(flagp) int *flagp; { - register char *ret; - register char op; - register char *next; + char *ret; + char op; + char *next; int flags; ret = regatom(&flags); @@ -471,7 +475,7 @@ static char * regatom(flagp) int *flagp; { - register char *ret; + char *ret; int flags; *flagp = WORST; /* Tentatively. */ @@ -489,8 +493,8 @@ int *flagp; *flagp |= HASWIDTH|SIMPLE; break; case '[': { - register int class; - register int classend; + int class; + int classend; int i; if (*regparse == '^') { /* Complement of range. */ @@ -597,7 +601,7 @@ int *flagp; */ { char *regprev; - register char ch; + char ch; regparse--; /* Look at cur char */ ret = regnode(EXACTLY); @@ -661,8 +665,8 @@ static char * /* Location. */ regnode(op) char op; { - register char *ret; - register char *ptr; + char *ret; + char *ptr; ret = regcode; if (ret == ®dummy) { @@ -702,9 +706,9 @@ reginsert(op, opnd) char op; char *opnd; { - register char *src; - register char *dst; - register char *place; + char *src; + char *dst; + char *place; if (regcode == ®dummy) { regsize += 3; @@ -731,9 +735,9 @@ regtail(p, val) char *p; char *val; { - register char *scan; - register char *temp; - register int offset; + char *scan; + char *temp; + int offset; if (p == ®dummy) return; @@ -799,10 +803,10 @@ STATIC char *regprop(); */ int regexec(prog, string) -register const regexp *prog; -register const char *string; +const regexp *prog; +const char *string; { - register char *s; + char *s; extern char *strchr(); /* Be paranoid... */ @@ -864,9 +868,9 @@ regtry(prog, string) regexp *prog; char *string; { - register int i; - register char **sp; - register char **ep; + int i; + char **sp; + char **ep; reginput = string; regstartp = prog->startp; @@ -900,7 +904,7 @@ static int /* 0 failure, 1 success */ regmatch(prog) char *prog; { - register char *scan; /* Current node. */ + char *scan; /* Current node. */ char *next; /* Next node. */ scan = prog; @@ -945,8 +949,8 @@ char *prog; reginput++; break; case EXACTLY: { - register int len; - register char *opnd; + int len; + char *opnd; opnd = OPERAND(scan); /* Inline the first character, for speed. */ @@ -981,8 +985,8 @@ char *prog; case OPEN+7: case OPEN+8: case OPEN+9: { - register int no; - register char *save; + int no; + char *save; no = OP(scan) - OPEN; save = reginput; @@ -1009,8 +1013,8 @@ char *prog; case CLOSE+7: case CLOSE+8: case CLOSE+9: { - register int no; - register char *save; + int no; + char *save; no = OP(scan) - CLOSE; save = reginput; @@ -1029,7 +1033,7 @@ char *prog; } break; case BRANCH: { - register char *save; + char *save; if (OP(next) != BRANCH) /* No choice. */ next = OPERAND(scan); /* Avoid recursion. */ @@ -1048,10 +1052,10 @@ char *prog; break; case STAR: case PLUS: { - register char nextch; - register int no; - register char *save; - register int min; + char nextch; + int no; + char *save; + int min; /* * Lookahead to avoid useless match attempts @@ -1102,9 +1106,9 @@ static int regrepeat(p) char *p; { - register int count = 0; - register char *scan; - register char *opnd; + int count = 0; + char *scan; + char *opnd; scan = reginput; opnd = OPERAND(p); @@ -1146,9 +1150,9 @@ char *p; */ static char * regnext(p) -register char *p; +char *p; { - register int offset; + int offset; if (p == ®dummy) return(NULL); @@ -1174,9 +1178,9 @@ void regdump(r) regexp *r; { - register char *s; - register char op = EXACTLY; /* Arbitrary non-END op. */ - register char *next; + char *s; + char op = EXACTLY; /* Arbitrary non-END op. */ + char *next; extern char *strchr(); @@ -1218,7 +1222,7 @@ static char * regprop(op) char *op; { - register char *p; + char *p; static char buf[50]; (void) strcpy(buf, ":"); @@ -1317,9 +1321,9 @@ strcspn(s1, s2) char *s1; char *s2; { - register char *scan1; - register char *scan2; - register int count; + char *scan1; + char *scan2; + int count; count = 0; for (scan1 = s1; *scan1 != '\0'; scan1++) { |