From b10e96eb2e4926f5b488dea32fe05760b6ccb8c1 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 25 Jul 2022 18:47:40 +0100 Subject: [PATCH] docs: Fix example in the manual It still contained references to PCRE functions pcre_exec and pcre_compile. Replace with PCRE2 equivalents. Fixes: commit 9a43a3bea411be5de83c64a2f1d28f365de7133f --- miniexpect.pod | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/miniexpect.pod b/miniexpect.pod index d640484..e93ff67 100644 --- a/miniexpect.pod +++ b/miniexpect.pod @@ -302,7 +302,7 @@ returned in C. =item C -There was a C error. Cpcre_error> is set to the +There was a C error. Cpcre_error> is set to the error code. See L for a list of the C error codes and what they mean. @@ -367,13 +367,15 @@ literal" and is available in C99. If you need to use an older compiler, you can just use a local variable instead. mexp_h *h; - char *errptr; + int errcode; int offset; pcre2_code *password_re, *prompt_re; pcre2_match_data *match_data = pcre2_match_data_create (4, NULL); - password_re = pcre_compile ("assword", 0, &errptr, &offset, NULL); - prompt_re = pcre_compile ("[$#] ", 0, &errptr, &offset, NULL); + password_re = pcre2_compile ("assword", PCRE2_ZERO_TERMINATED, + 0, &errcode, &offset, NULL); + prompt_re = pcre2_compile ("[$#] ", PCRE2_ZERO_TERMINATED, + 0, &errcode, &offset, NULL); switch (mexp_expect (h, (mexp_regexp[]) { -- 1.8.3.1