From: wessels <> Date: Sun, 24 Nov 1996 11:17:05 +0000 (+0000) Subject: regex mucking so HP dudes dont have to put up with GNUregex X-Git-Tag: SQUID_3_0_PRE1~5422 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=008fcc7bc692148a96f46cab208d08ecc568726b;p=thirdparty%2Fsquid.git regex mucking so HP dudes dont have to put up with GNUregex --- diff --git a/src/acl.cc b/src/acl.cc index a2f4f60593..4a52f9fe88 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,5 +1,5 @@ /* - * $Id: acl.cc,v 1.64 1996/11/15 07:51:04 wessels Exp $ + * $Id: acl.cc,v 1.65 1996/11/24 04:17:05 wessels Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -407,14 +407,18 @@ aclParseRegexList(int icase) relist *q = NULL; char *t = NULL; regex_t comp; - int flags = REG_EXTENDED; + int errcode; + int flags = REG_EXTENDED | REG_NOSUB; if (icase) flags |= REG_ICASE; while ((t = strtokFile())) { - if (regcomp(&comp, t, flags) != REG_NOERROR) { + if ((errcode = regcomp(&comp, t, flags)) != 0) { + char errbuf[256]; + regerror(errcode, &comp, errbuf, sizeof errbuf); debug(28, 0, "%s line %d: %s\n", cfg_filename, config_lineno, config_input_line); - debug(28, 0, "aclParseRegexList: Invalid regular expression: '%s'\n", t); + debug(28, 0, "aclParseRegexList: Invalid regular expression '%s': %s\n", + t, errbuf); continue; } q = xcalloc(1, sizeof(relist)); diff --git a/src/refresh.cc b/src/refresh.cc index b999bb991f..01a3d64c2c 100644 --- a/src/refresh.cc +++ b/src/refresh.cc @@ -1,6 +1,6 @@ /* - * $Id: refresh.cc,v 1.8 1996/11/18 18:21:41 wessels Exp $ + * $Id: refresh.cc,v 1.9 1996/11/24 04:17:05 wessels Exp $ * * DEBUG: section 22 Refresh Calculation * AUTHOR: Harvest Derived @@ -82,12 +82,17 @@ refreshAddToList(const char *pattern, int opts, time_t min, int pct, time_t max) { refresh_t *t; regex_t comp; - int flags = REG_EXTENDED; + int errcode; + int flags = REG_EXTENDED | REG_NOSUB; if (opts & REFRESH_ICASE) flags |= REG_ICASE; - if (regcomp(&comp, pattern, flags) != REG_NOERROR) { - debug(22, 0, "refreshAddToList: Invalid regular expression: %s\n", - pattern); + if ((errcode = regcomp(&comp, pattern, flags)) != 0) { + char errbuf[256]; + regerror(errcode, &comp, errbuf, sizeof errbuf); + debug(22, 0, "%s line %d: %s\n", + cfg_filename, config_lineno, config_input_line); + debug(22, 0, "refreshAddToList: Invalid regular expression '%s': %s\n", + pattern, errbuf); return; } pct = pct < 0 ? 0 : pct;