From: loth AT gec DOT net (Burton Radons) To: djgpp-workers AT delorie DOT com Subject: Regex patch Date: Tue, 07 Jul 1998 21:14:36 GMT Message-ID: <35a68f9e.9230585@mail.cow-net.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Precedence: bulk This patch of the src/posix/regex directory performs all changes necessary to compile with -W -Wall -Wno-unused (My standard warning set). I didn't change anything that wasn't necessary, to avoid enbuggery. Hope I got the patch order right. Sorry if I didn't. - Burton Radons *** src\libc\posix\regex~1\cclass.h Tue Jun 13 01:35:08 1995 --- src\libc\posix\regex\cclass.h Mon Jul 6 09:53:44 1998 *************** *** 5,32 **** char *chars; char *multis; } cclasses[] = { ! "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ ! 0123456789", "", ! "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", ! "", ! "blank", " \t", "", ! "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\ ! \25\26\27\30\31\32\33\34\35\36\37\177", "", ! "digit", "0123456789", "", ! "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ ! 0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", ! "", ! "lower", "abcdefghijklmnopqrstuvwxyz", ! "", ! "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ ! 0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", ! "", ! "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", ! "", ! "space", "\t\n\v\f\r ", "", ! "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", ! "", ! "xdigit", "0123456789ABCDEFabcdef", ! "", ! NULL, 0, "" }; --- 5,21 ---- char *chars; char *multis; } cclasses[] = { ! { "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "" }, ! { "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "" }, ! { "blank", " \t", "" }, ! { "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177", "" }, ! { "digit", "0123456789", "" }, ! { "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "" }, ! { "lower", "abcdefghijklmnopqrstuvwxyz", "" }, ! { "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", "" }, ! { "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "" }, ! { "space", "\t\n\v\f\r ", "" }, ! { "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "" }, ! { "xdigit", "0123456789ABCDEFabcdef", "" }, ! { NULL, 0, "" } }; *** src\libc\posix\regex~1\cname.h Tue Jun 13 01:35:08 1995 --- src\libc\posix\regex\cname.h Mon Jul 6 09:56:24 1998 *************** *** 4,103 **** char *name; char code; } cnames[] = { ! "NUL", '\0', ! "SOH", '\001', ! "STX", '\002', ! "ETX", '\003', ! "EOT", '\004', ! "ENQ", '\005', ! "ACK", '\006', ! "BEL", '\007', ! "alert", '\007', ! "BS", '\010', ! "backspace", '\b', ! "HT", '\011', ! "tab", '\t', ! "LF", '\012', ! "newline", '\n', ! "VT", '\013', ! "vertical-tab", '\v', ! "FF", '\014', ! "form-feed", '\f', ! "CR", '\015', ! "carriage-return", '\r', ! "SO", '\016', ! "SI", '\017', ! "DLE", '\020', ! "DC1", '\021', ! "DC2", '\022', ! "DC3", '\023', ! "DC4", '\024', ! "NAK", '\025', ! "SYN", '\026', ! "ETB", '\027', ! "CAN", '\030', ! "EM", '\031', ! "SUB", '\032', ! "ESC", '\033', ! "IS4", '\034', ! "FS", '\034', ! "IS3", '\035', ! "GS", '\035', ! "IS2", '\036', ! "RS", '\036', ! "IS1", '\037', ! "US", '\037', ! "space", ' ', ! "exclamation-mark", '!', ! "quotation-mark", '"', ! "number-sign", '#', ! "dollar-sign", '$', ! "percent-sign", '%', ! "ampersand", '&', ! "apostrophe", '\'', ! "left-parenthesis", '(', ! "right-parenthesis", ')', ! "asterisk", '*', ! "plus-sign", '+', ! "comma", ',', ! "hyphen", '-', ! "hyphen-minus", '-', ! "period", '.', ! "full-stop", '.', ! "slash", '/', ! "solidus", '/', ! "zero", '0', ! "one", '1', ! "two", '2', ! "three", '3', ! "four", '4', ! "five", '5', ! "six", '6', ! "seven", '7', ! "eight", '8', ! "nine", '9', ! "colon", ':', ! "semicolon", ';', ! "less-than-sign", '<', ! "equals-sign", '=', ! "greater-than-sign", '>', ! "question-mark", '?', ! "commercial-at", '@', ! "left-square-bracket", '[', ! "backslash", '\\', ! "reverse-solidus", '\\', ! "right-square-bracket", ']', ! "circumflex", '^', ! "circumflex-accent", '^', ! "underscore", '_', ! "low-line", '_', ! "grave-accent", '`', ! "left-brace", '{', ! "left-curly-bracket", '{', ! "vertical-line", '|', ! "right-brace", '}', ! "right-curly-bracket", '}', ! "tilde", '~', ! "DEL", '\177', ! NULL, 0, }; --- 4,103 ---- char *name; char code; } cnames[] = { ! { "NUL", '\0' }, ! { "SOH", '\001' }, ! { "STX", '\002' }, ! { "ETX", '\003' }, ! { "EOT", '\004' }, ! { "ENQ", '\005' }, ! { "ACK", '\006' }, ! { "BEL", '\007' }, ! { "alert", '\007' }, ! { "BS", '\010' }, ! { "backspace", '\b' }, ! { "HT", '\011' }, ! { "tab", '\t' }, ! { "LF", '\012' }, ! { "newline", '\n' }, ! { "VT", '\013' }, ! { "vertical-tab", '\v' }, ! { "FF", '\014' }, ! { "form-feed", '\f' }, ! { "CR", '\015' }, ! { "carriage-return", '\r' }, ! { "SO", '\016' }, ! { "SI", '\017' }, ! { "DLE", '\020' }, ! { "DC1", '\021' }, ! { "DC2", '\022' }, ! { "DC3", '\023' }, ! { "DC4", '\024' }, ! { "NAK", '\025' }, ! { "SYN", '\026' }, ! { "ETB", '\027' }, ! { "CAN", '\030' }, ! { "EM", '\031' }, ! { "SUB", '\032' }, ! { "ESC", '\033' }, ! { "IS4", '\034' }, ! { "FS", '\034' }, ! { "IS3", '\035' }, ! { "GS", '\035' }, ! { "IS2", '\036' }, ! { "RS", '\036' }, ! { "IS1", '\037' }, ! { "US", '\037' }, ! { "space", ' ' }, ! { "exclamation-mark", '!' }, ! { "quotation-mark", '"' }, ! { "number-sign", '#' }, ! { "dollar-sign", '$' }, ! { "percent-sign", '%' }, ! { "ampersand", '&' }, ! { "apostrophe", '\'' }, ! { "left-parenthesis", '(' }, ! { "right-parenthesis", ')' }, ! { "asterisk", '*' }, ! { "plus-sign", '+' }, ! { "comma", ',' }, ! { "hyphen", '-' }, ! { "hyphen-minus", '-' }, ! { "period", '.' }, ! { "full-stop", '.' }, ! { "slash", '/' }, ! { "solidus", '/' }, ! { "zero", '0' }, ! { "one", '1' }, ! { "two", '2' }, ! { "three", '3' }, ! { "four", '4' }, ! { "five", '5' }, ! { "six", '6' }, ! { "seven", '7' }, ! { "eight", '8' }, ! { "nine", '9' }, ! { "colon", ':' }, ! { "semicolon", ';' }, ! { "less-than-sign", '<' }, ! { "equals-sign", '=' }, ! { "greater-than-sign", '>' }, ! { "question-mark", '?' }, ! { "commercial-at", '@' }, ! { "left-square-bracket", '[' }, ! { "backslash", '\\' }, ! { "reverse-solidus", '\\' }, ! { "right-square-bracket", ']' }, ! { "circumflex", '^' }, ! { "circumflex-accent", '^' }, ! { "underscore", '_' }, ! { "low-line", '_' }, ! { "grave-accent", '`' }, ! { "left-brace", '{' }, ! { "left-curly-bracket", '{' }, ! { "vertical-line", '|' }, ! { "right-brace", '}' }, ! { "right-curly-bracket", '}' }, ! { "tilde", '~' }, ! { "DEL", '\177' }, ! { NULL, 0 } }; *** src\libc\posix\regex~1\debug.c Tue Jun 13 01:35:08 1995 --- src\libc\posix\regex\debug.c Mon Jul 6 09:41:30 1998 *************** *** 198,223 **** break; case OCH_: fprintf(d, "<"); ! if (OP(*(s+opnd)) != OOR2) fprintf(d, "<%ld>", (long)opnd); break; case OOR1: ! if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_) fprintf(d, "<%ld>", (long)opnd); fprintf(d, "|"); break; case OOR2: fprintf(d, "|"); ! if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH) fprintf(d, "<%ld>", (long)opnd); break; case O_CH: ! if (OP(*(s-opnd)) != OOR1) fprintf(d, "<%ld>", (long)opnd); fprintf(d, ">"); break; default: ! fprintf(d, "!%d(%d)!", OP(*s), opnd); break; } if (!done) --- 198,223 ---- break; case OCH_: fprintf(d, "<"); ! if (OP(*(s+opnd)) != (unsigned) OOR2) fprintf(d, "<%ld>", (long)opnd); break; case OOR1: ! if (OP(*(s-opnd)) != (unsigned) OOR1 && OP(*(s-opnd)) != OCH_) fprintf(d, "<%ld>", (long)opnd); fprintf(d, "|"); break; case OOR2: fprintf(d, "|"); ! if (OP(*(s+opnd)) != (unsigned) OOR2 && OP(*(s+opnd)) != (unsigned) O_CH) fprintf(d, "<%ld>", (long)opnd); break; case O_CH: ! if (OP(*(s-opnd)) != (unsigned) OOR1) fprintf(d, "<%ld>", (long)opnd); fprintf(d, ">"); break; default: ! fprintf(d, "!%ld(%ld)!", OP(*s), opnd); break; } if (!done) *** src\libc\posix\regex~1\engine.c Tue Jun 13 01:35:08 1995 --- src\libc\posix\regex\engine.c Mon Jul 6 10:03:02 1998 *************** *** 76,83 **** struct match mv; register struct match *m = &mv; register char *dp; ! const register sopno gf = g->firststate+1; /* +1 for OEND */ ! const register sopno gl = g->laststate; char *start; char *stop; --- 76,83 ---- struct match mv; register struct match *m = &mv; register char *dp; ! register const sopno gf = g->firststate+1; /* +1 for OEND */ ! register const sopno gl = g->laststate; char *start; char *stop; *************** *** 150,156 **** STATETEARDOWN(m); return(REG_ESPACE); } ! for (i = 1; i <= m->g->nsub; i++) m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1; if (!g->backrefs && !(m->eflags®_BACKR)) { NOTE("dissecting"); --- 150,156 ---- STATETEARDOWN(m); return(REG_ESPACE); } ! for (i = 1; (unsigned) i <= m->g->nsub; i++) m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1; if (!g->backrefs && !(m->eflags®_BACKR)) { NOTE("dissecting"); *************** *** 207,214 **** } if (nmatch > 1) { assert(m->pmatch != NULL); ! for (i = 1; i < nmatch; i++) ! if (i <= m->g->nsub) pmatch[i] = m->pmatch[i]; else { pmatch[i].rm_so = -1; --- 207,214 ---- } if (nmatch > 1) { assert(m->pmatch != NULL); ! for (i = 1; (unsigned) i < nmatch; i++) ! if ((unsigned) i <= m->g->nsub) pmatch[i] = m->pmatch[i]; else { pmatch[i].rm_so = -1; *************** *** 262,268 **** es += OPND(m->g->strip[es]); break; case OCH_: ! while (OP(m->g->strip[es]) != O_CH) es += OPND(m->g->strip[es]); break; } --- 262,268 ---- es += OPND(m->g->strip[es]); break; case OCH_: ! while (OP(m->g->strip[es]) != (unsigned) O_CH) es += OPND(m->g->strip[es]); break; } *************** *** 376,382 **** assert(OP(m->g->strip[esub]) == OOR2); ssub = esub + 1; esub += OPND(m->g->strip[esub]); ! if (OP(m->g->strip[esub]) == OOR2) esub--; else assert(OP(m->g->strip[esub]) == O_CH); --- 376,382 ---- assert(OP(m->g->strip[esub]) == OOR2); ssub = esub + 1; esub += OPND(m->g->strip[esub]); ! if (OP(m->g->strip[esub]) == (unsigned) OOR2) esub--; else assert(OP(m->g->strip[esub]) == O_CH); *************** *** 505,511 **** do { assert(OP(s) == OOR2); ss += OPND(s); ! } while (OP(s = m->g->strip[ss]) != O_CH); /* note that the ss++ gets us past the O_CH */ break; default: /* have to make a choice */ --- 505,511 ---- do { assert(OP(s) == OOR2); ss += OPND(s); ! } while (OP(s = m->g->strip[ss]) != (unsigned) O_CH); /* note that the ss++ gets us past the O_CH */ break; default: /* have to make a choice */ *************** *** 536,542 **** ssp = m->offp + m->pmatch[i].rm_so; if (memcmp(sp, ssp, len) != 0) return(NULL); ! while (m->g->strip[ss] != SOP(O_BACK, i)) ss++; return(backref(m, sp+len, stop, ss+1, stopst, lev)); break; --- 536,542 ---- ssp = m->offp + m->pmatch[i].rm_so; if (memcmp(sp, ssp, len) != 0) return(NULL); ! while (m->g->strip[ss] != (unsigned) SOP(O_BACK, i)) ss++; return(backref(m, sp+len, stop, ss+1, stopst, lev)); break; *************** *** 572,584 **** if (dp != NULL) return(dp); /* that one missed, try next one */ ! if (OP(m->g->strip[esub]) == O_CH) return(NULL); /* there is none */ esub++; assert(OP(m->g->strip[esub]) == OOR2); ssub = esub + 1; esub += OPND(m->g->strip[esub]); ! if (OP(m->g->strip[esub]) == OOR2) esub--; else assert(OP(m->g->strip[esub]) == O_CH); --- 572,584 ---- if (dp != NULL) return(dp); /* that one missed, try next one */ ! if (OP(m->g->strip[esub]) == (unsigned) O_CH) return(NULL); /* there is none */ esub++; assert(OP(m->g->strip[esub]) == OOR2); ssub = esub + 1; esub += OPND(m->g->strip[esub]); ! if (OP(m->g->strip[esub]) == (unsigned) OOR2) esub--; else assert(OP(m->g->strip[esub]) == O_CH); *************** *** 614,619 **** --- 614,621 ---- /* "can't happen" */ assert(nope); /* NOTREACHED */ + /* Well, DJGPP doesn't care */ + return NULL; } /* *************** *** 897,903 **** case OOR1: /* done a branch, find the O_CH */ if (ISSTATEIN(aft, here)) { for (look = 1; ! OP(s = g->strip[pc+look]) != O_CH; look += OPND(s)) assert(OP(s) == OOR2); FWD(aft, aft, look); --- 899,905 ---- case OOR1: /* done a branch, find the O_CH */ if (ISSTATEIN(aft, here)) { for (look = 1; ! OP(s = g->strip[pc+look]) != (unsigned) O_CH; look += OPND(s)) assert(OP(s) == OOR2); FWD(aft, aft, look); *************** *** 905,911 **** break; case OOR2: /* propagate OCH_'s marking */ FWD(aft, aft, 1); ! if (OP(g->strip[pc+OPND(s)]) != O_CH) { assert(OP(g->strip[pc+OPND(s)]) == OOR2); FWD(aft, aft, OPND(s)); } --- 907,913 ---- break; case OOR2: /* propagate OCH_'s marking */ FWD(aft, aft, 1); ! if (OP(g->strip[pc+OPND(s)]) != (unsigned) O_CH) { assert(OP(g->strip[pc+OPND(s)]) == OOR2); FWD(aft, aft, OPND(s)); } *** src\libc\posix\regex~1\main.c Tue Jun 13 01:35:08 1995 --- src\libc\posix\regex\main.c Mon Jul 6 10:07:08 1998 *************** *** 1,9 **** --- 1,11 ---- /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include + #include #include #include #include #include + #include #include "main.ih" *************** *** 24,30 **** /* - main - do the simple case, hand off to regress() for regression */ ! main(argc, argv) int argc; char *argv[]; { --- 26,32 ---- /* - main - do the simple case, hand off to regress() for regression */ ! int main(argc, argv) int argc; char *argv[]; { *************** *** 78,84 **** err = regcomp(&re, argv[optind++], copts); if (err) { len = regerror(err, &re, erbuf, sizeof(erbuf)); ! fprintf(stderr, "error %s, %d/%d `%s'\n", eprint(err), len, sizeof(erbuf), erbuf); exit(status); } --- 80,86 ---- err = regcomp(&re, argv[optind++], copts); if (err) { len = regerror(err, &re, erbuf, sizeof(erbuf)); ! fprintf(stderr, "error %s, %ld/%ld `%s'\n", eprint(err), len, sizeof(erbuf), erbuf); exit(status); } *************** *** 96,102 **** err = regexec(&re, argv[optind], (size_t)NS, subs, eopts); if (err) { len = regerror(err, &re, erbuf, sizeof(erbuf)); ! fprintf(stderr, "error %s, %d/%d `%s'\n", eprint(err), len, sizeof(erbuf), erbuf); exit(status); } --- 98,104 ---- err = regexec(&re, argv[optind], (size_t)NS, subs, eopts); if (err) { len = regerror(err, &re, erbuf, sizeof(erbuf)); ! fprintf(stderr, "error %s, %ld/%ld `%s'\n", eprint(err), len, sizeof(erbuf), erbuf); exit(status); } *************** *** 104,110 **** len = (int)(subs[0].rm_eo - subs[0].rm_so); if (subs[0].rm_so != -1) { if (len != 0) ! printf("match `%.*s'\n", len, argv[optind] + subs[0].rm_so); else printf("match `'@%.1s\n", --- 106,112 ---- len = (int)(subs[0].rm_eo - subs[0].rm_so); if (subs[0].rm_so != -1) { if (len != 0) ! printf("match `%.*s'\n", (int) len, argv[optind] + subs[0].rm_so); else printf("match `'@%.1s\n", *************** *** 123,131 **** - regress - main loop of regression test == void regress(FILE *in); */ ! void ! regress(in) ! FILE *in; { char inbuf[1000]; # define MAXF 10 --- 125,131 ---- - regress - main loop of regression test == void regress(FILE *in); */ ! void regress(FILE *in) { char inbuf[1000]; # define MAXF 10 *************** *** 231,237 **** if (err != 0 && (!opt('C', f1) || err != efind(f2))) { /* unexpected error or wrong error */ len = regerror(err, &re, erbuf, sizeof(erbuf)); ! fprintf(stderr, "%d: %s error %s, %d/%d `%s'\n", line, type, eprint(err), len, sizeof(erbuf), erbuf); status = 1; --- 231,237 ---- if (err != 0 && (!opt('C', f1) || err != efind(f2))) { /* unexpected error or wrong error */ len = regerror(err, &re, erbuf, sizeof(erbuf)); ! fprintf(stderr, "%d: %s error %s, %d/%ld `%s'\n", line, type, eprint(err), len, sizeof(erbuf), erbuf); status = 1; *************** *** 262,268 **** if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) { /* unexpected error or wrong error */ len = regerror(err, &re, erbuf, sizeof(erbuf)); ! fprintf(stderr, "%d: %s exec error %s, %d/%d `%s'\n", line, type, eprint(err), len, sizeof(erbuf), erbuf); status = 1; --- 262,268 ---- if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) { /* unexpected error or wrong error */ len = regerror(err, &re, erbuf, sizeof(erbuf)); ! fprintf(stderr, "%d: %s exec error %s, %d/%ld `%s'\n", line, type, eprint(err), len, sizeof(erbuf), erbuf); status = 1; *************** *** 438,444 **** return("did not match"); /* check for in range */ ! if (sub.rm_eo > strlen(str)) { sprintf(grump, "start %ld end %ld, past end of string", (long)sub.rm_so, (long)sub.rm_eo); return(grump); --- 438,444 ---- return("did not match"); /* check for in range */ ! if ((unsigned) sub.rm_eo > strlen(str)) { sprintf(grump, "start %ld end %ld, past end of string", (long)sub.rm_so, (long)sub.rm_eo); return(grump); *** src\libc\posix\regex~1\regcomp.c Tue Jun 13 01:35:08 1995 --- src\libc\posix\regex\regcomp.c Mon Jul 6 09:59:20 1998 *************** *** 1061,1067 **** register cset *top = &p->g->sets[p->g->ncsets]; register size_t css = (size_t)p->g->csetsize; ! for (i = 0; i < css; i++) CHsub(cs, i); if (cs == top-1) /* recover only the easy case */ p->g->ncsets--; --- 1061,1067 ---- register cset *top = &p->g->sets[p->g->ncsets]; register size_t css = (size_t)p->g->csetsize; ! for (i = 0; (unsigned) i < css; i++) CHsub(cs, i); if (cs == top-1) /* recover only the easy case */ p->g->ncsets--; *************** *** 1092,1101 **** for (cs2 = &p->g->sets[0]; cs2 < top; cs2++) if (cs2->hash == h && cs2 != cs) { /* maybe */ ! for (i = 0; i < css; i++) if (!!CHIN(cs2, i) != !!CHIN(cs, i)) break; /* no */ ! if (i == css) break; /* yes */ } --- 1092,1101 ---- for (cs2 = &p->g->sets[0]; cs2 < top; cs2++) if (cs2->hash == h && cs2 != cs) { /* maybe */ ! for (i = 0; (unsigned) i < css; i++) if (!!CHIN(cs2, i) != !!CHIN(cs, i)) break; /* no */ ! if ((unsigned) i == css) break; /* yes */ } *************** *** 1119,1125 **** register int i; register size_t css = (size_t)p->g->csetsize; ! for (i = 0; i < css; i++) if (CHIN(cs, i)) return((char)i); assert(never); --- 1119,1125 ---- register int i; register size_t css = (size_t)p->g->csetsize; ! for (i = 0; (unsigned) i < css; i++) if (CHIN(cs, i)) return((char)i); assert(never); *************** *** 1139,1145 **** register size_t css = (size_t)p->g->csetsize; register int n = 0; ! for (i = 0; i < css; i++) if (CHIN(cs, i)) n++; return(n); --- 1139,1145 ---- register size_t css = (size_t)p->g->csetsize; register int n = 0; ! for (i = 0; (unsigned) i < css; i++) if (CHIN(cs, i)) n++; return(n); *************** *** 1531,1542 **** scan += OPND(s); s = *scan; /* assert() interferes w debug printouts */ ! if (OP(s) != O_QUEST && OP(s) != O_CH && ! OP(s) != OOR2) { g->iflags |= BAD; return; } ! } while (OP(s) != O_QUEST && OP(s) != O_CH); /* fallthrough */ default: /* things that break a sequence */ if (newlen > g->mlen) { /* ends one */ --- 1531,1543 ---- scan += OPND(s); s = *scan; /* assert() interferes w debug printouts */ ! if (OP(s) != O_QUEST && ! OP(s) != (unsigned) O_CH && ! OP(s) != (unsigned) OOR2) { g->iflags |= BAD; return; } ! } while (OP(s) != O_QUEST && OP(s) != (unsigned) O_CH); /* fallthrough */ default: /* things that break a sequence */ if (newlen > g->mlen) { /* ends one */ *** src\libc\posix\regex~1\regerror.c Tue Jun 13 01:35:08 1995 --- src\libc\posix\regex\regerror.c Mon Jul 6 10:00:02 1998 *************** *** 35,57 **** char *name; char *explain; } rerrs[] = { ! REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match", ! REG_BADPAT, "REG_BADPAT", "invalid regular expression", ! REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element", ! REG_ECTYPE, "REG_ECTYPE", "invalid character class", ! REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)", ! REG_ESUBREG, "REG_ESUBREG", "invalid backreference number", ! REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced", ! REG_EPAREN, "REG_EPAREN", "parentheses not balanced", ! REG_EBRACE, "REG_EBRACE", "braces not balanced", ! REG_BADBR, "REG_BADBR", "invalid repetition count(s)", ! REG_ERANGE, "REG_ERANGE", "invalid character range", ! REG_ESPACE, "REG_ESPACE", "out of memory", ! REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid", ! REG_EMPTY, "REG_EMPTY", "empty (sub)expression", ! REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug", ! REG_INVARG, "REG_INVARG", "invalid argument to regex routine", ! 0, "", "*** unknown regexp error code ***", }; /* --- 35,57 ---- char *name; char *explain; } rerrs[] = { ! { REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match" }, ! { REG_BADPAT, "REG_BADPAT", "invalid regular expression" }, ! { REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element" }, ! { REG_ECTYPE, "REG_ECTYPE", "invalid character class" }, ! { REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)" }, ! { REG_ESUBREG, "REG_ESUBREG", "invalid backreference number" }, ! { REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced" }, ! { REG_EPAREN, "REG_EPAREN", "parentheses not balanced" }, ! { REG_EBRACE, "REG_EBRACE", "braces not balanced" }, ! { REG_BADBR, "REG_BADBR", "invalid repetition count(s)" }, ! { REG_ERANGE, "REG_ERANGE", "invalid character range" }, ! { REG_ESPACE, "REG_ESPACE", "out of memory" }, ! { REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid" }, ! { REG_EMPTY, "REG_EMPTY", "empty (sub)expression" }, ! { REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug" }, ! { REG_INVARG, "REG_INVARG", "invalid argument to regex routine" }, ! { 0, "", "*** unknown regexp error code ***" }, }; /* *** src\libc\posix\regex~1\regexec.c Tue Jun 13 01:35:08 1995 --- src\libc\posix\regex\regexec.c Mon Jul 6 10:03:24 1998 *************** *** 132,138 **** return(REG_BADPAT); eflags = GOODFLAGS(eflags); ! if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags®_LARGE)) return(smatcher(g, (char *)string, nmatch, pmatch, eflags)); else return(lmatcher(g, (char *)string, nmatch, pmatch, eflags)); --- 132,138 ---- return(REG_BADPAT); eflags = GOODFLAGS(eflags); ! if ((unsigned) g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags®_LARGE)) return(smatcher(g, (char *)string, nmatch, pmatch, eflags)); else return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));