From fd2d0f7165d390ce4b4d08acf25552f6635d9ecb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 10 Apr 2023 11:31:58 -0700 Subject: grep: improve PCRE2 version output * src/grep.c: No need to include pcre2.h. (main) [HAVE_LIBPCRE]: Call Pprint_version instead of doing it ourselves. * src/pcresearch.c (Pprint_version): New function. It also checks belatedly for buffer overflow, and says "grep -P uses PCRE2" instead of "Built with PCRE". * tests/version-pcre: Adjust test to match. --- src/grep.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/grep.c') diff --git a/src/grep.c b/src/grep.c index bd776e8b..491dd028 100644 --- a/src/grep.c +++ b/src/grep.c @@ -29,11 +29,6 @@ #include #include "system.h" -#if HAVE_LIBPCRE -# define PCRE2_CODE_UNIT_WIDTH 8 -# include -#endif - #include "argmatch.h" #include "c-ctype.h" #include "c-stack.h" @@ -2836,10 +2831,7 @@ main (int argc, char **argv) puts (_("Written by Mike Haertel and others; see\n" ".")); #if HAVE_LIBPCRE - unsigned char buf[128]; - (void) pcre2_config (PCRE2_CONFIG_VERSION, buf); - fputs (_("\nBuilt with PCRE "), stdout); - puts ((char *) buf); + Pprint_version (); #endif return EXIT_SUCCESS; } -- cgit v1.2.1