-/* $Cambridge: exim/src/exim_monitor/em_init.c,v 1.4 2007/01/08 10:50:17 ph10 Exp $ */
-
/*************************************************
* Exim monitor *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 2007 */
+/* 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
work. */
for (i = 0; i <= 1; i++)
-
{
int first = 1;
int count = 0;
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 %l "
+ "while compiling %s\n", errbuf, (long)offset, buffer);
exit(99);
}
}
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 *));
}
}
void init(int argc, uschar **argv)
{
int x;
-int erroroffset;
+size_t erroroffset;
uschar *s;
const uschar *error;
/* 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 */