]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
regex mucking so HP dudes dont have to put up with GNUregex
authorwessels <>
Sun, 24 Nov 1996 11:17:05 +0000 (11:17 +0000)
committerwessels <>
Sun, 24 Nov 1996 11:17:05 +0000 (11:17 +0000)
src/acl.cc
src/refresh.cc

index a2f4f605939edf45b0589a4096acf0e5c98ba951..4a52f9fe881b440900f85ad0fdbf5ea402897469 100644 (file)
@@ -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));
index b999bb991fd393a89f890909b1b726bc5652b61e..01a3d64c2cf27c18a46466549294aefac7b79512 100644 (file)
@@ -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;