diff options
author | Sascha Schumann <sas@php.net> | 1999-11-12 20:27:52 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 1999-11-12 20:27:52 +0000 |
commit | 6f572248907b8489b360ed2f030c10a2f5bb2e67 (patch) | |
tree | e5ff355bae61dce747aa699b24bdaabc025e8c45 /regex/regerror.c | |
parent | e20e9786b3a1de2f209df560c43e36eb74af046a (diff) | |
download | php-git-6f572248907b8489b360ed2f030c10a2f5bb2e67.tar.gz |
upgrade regex library to alpha3.8
@- Upgraded regex library to alpha3.8 (Sascha)
Diffstat (limited to 'regex/regerror.c')
-rw-r--r-- | regex/regerror.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/regex/regerror.c b/regex/regerror.c index 12edd4e164..9158870322 100644 --- a/regex/regerror.c +++ b/regex/regerror.c @@ -10,6 +10,7 @@ #include "regerror.ih" /* + = #define REG_OKAY 0 = #define REG_NOMATCH 1 = #define REG_BADPAT 2 = #define REG_ECOLLATE 3 @@ -34,23 +35,24 @@ static struct rerr { 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 ***" } + REG_OKAY, "REG_OKAY", "no errors detected", + 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", + -1, "", "*** unknown regexp error code ***", }; /* @@ -74,12 +76,12 @@ size_t errbuf_size; if (errcode == REG_ATOI) s = regatoi(preg, convbuf); else { - for (r = rerrs; r->code != 0; r++) + for (r = rerrs; r->code >= 0; r++) if (r->code == target) break; if (errcode®_ITOA) { - if (r->code != 0) + if (r->code >= 0) (void) strcpy(convbuf, r->name); else sprintf(convbuf, "REG_0x%x", target); @@ -113,10 +115,10 @@ char *localbuf; { register struct rerr *r; - for (r = rerrs; r->code != 0; r++) + for (r = rerrs; r->code >= 0; r++) if (strcmp(r->name, preg->re_endp) == 0) break; - if (r->code == 0) + if (r->code < 0) return("0"); sprintf(localbuf, "%d", r->code); |