Use %ld not %l
[exim.git] / src / exim_monitor / em_init.c
index c9ef66a7e4c5df5d9465ad2bf8e6108659865179..ee27c20521a7028e3d3f10ee92c6b90f00a3b9ff 100644 (file)
@@ -3,6 +3,7 @@
 *************************************************/
 
 /* Copyright (c) University of Cambridge 1995 - 2009 */
+/* Copyright (c) The Exim Maintainers 2020 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 /* This module contains code to initialize things from the
@@ -31,7 +32,6 @@ int i;
 work. */
 
 for (i = 0; i <= 1; i++)
-
   {
   int first = 1;
   int count = 0;
@@ -68,14 +68,18 @@ for (i = 0; i <= 1; i++)
       buffer[p-pp] = 0;
       if (first)
         {
-        int offset;
-        const uschar *error;
-        stripchart_regex[indx] = pcre_compile(CS buffer, PCRE_COPT,
-          (const char **)&error, &offset, NULL);
-        if (stripchart_regex[indx] == NULL)
+        size_t offset;
+        int err;
+
+        if (!(stripchart_regex[indx] =
+               pcre2_compile((PCRE2_SPTR)buffer,
+                     PCRE2_ZERO_TERMINATED, PCRE_COPT,
+                     &err, &offset, NULL)))
           {
-          printf("regular expression error: %s at offset %d "
-            "while compiling %s\n", error, offset, buffer);
+         uschar errbuf[128];
+         pcre2_get_error_message(err, errbuf, sizeof(errbuf));
+          printf("regular expression error: %s at offset %ld "
+            "while compiling %s\n", errbuf, (long)offset, buffer);
           exit(99);
           }
         }
@@ -95,7 +99,7 @@ for (i = 0; i <= 1; i++)
   if (i == 0)
     {
     stripchart_number += count;
-    stripchart_regex = (pcre **)store_malloc(stripchart_number * sizeof(pcre *));
+    stripchart_regex = (pcre2_code **)store_malloc(stripchart_number * sizeof(pcre2_code *));
     stripchart_title = (uschar **)store_malloc(stripchart_number * sizeof(uschar *));
     }
   }
@@ -109,7 +113,7 @@ for (i = 0; i <= 1; i++)
 void init(int argc, uschar **argv)
 {
 int x;
-int erroroffset;
+size_t erroroffset;
 uschar *s;
 const uschar *error;
 
@@ -230,8 +234,8 @@ queue_stripchart_name = (s != NULL)? string_copy(s) : US"queue";
 
 /* Compile the regex for matching yyyy-mm-dd at the start of a string. */
 
-yyyymmdd_regex = pcre_compile("^\\d{4}-\\d\\d-\\d\\d\\s", PCRE_COPT,
-  (const char **)&error, &erroroffset, NULL);
+yyyymmdd_regex = pcre2_compile((PCRE2_SPTR)"^\\d{4}-\\d\\d-\\d\\d\\s",
+  PCRE2_ZERO_TERMINATED, PCRE_COPT, &x, &erroroffset, NULL);
 }
 
 /* End of em_init.c */