From d53a7449dca8ec558ca0b6c322c6d3351afe1c8b Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 6 Nov 2015 21:19:09 +0000 Subject: In ./configure, select a RE syntax for word boundaries supported by libc; issue reported by Svyatoslav Mishyn, Peter Bray, and Daniel Levai. --- mansearch.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'mansearch.c') diff --git a/mansearch.c b/mansearch.c index 41fdb499..756a73f9 100644 --- a/mansearch.c +++ b/mansearch.c @@ -1,4 +1,4 @@ -/* $Id: mansearch.c,v 1.60 2015/10/13 15:53:05 schwarze Exp $ */ +/* $Id: mansearch.c,v 1.61 2015/11/06 21:19:09 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015 Ingo Schwarze @@ -766,7 +766,14 @@ exprterm(const struct mansearch *search, char *buf, int cs) if (search->argmode == ARG_WORD) { e->bits = TYPE_Nm; e->substr = NULL; +#if HAVE_REWB_BSD mandoc_asprintf(&val, "[[:<:]]%s[[:>:]]", buf); +#elif HAVE_REWB_SYSV + mandoc_asprintf(&val, "\\<%s\\>", buf); +#else + mandoc_asprintf(&val, + "(^|[^a-zA-Z01-9_])%s([^a-zA-Z01-9_]|$)", buf); +#endif cs = 0; } else if ((val = strpbrk(buf, "=~")) == NULL) { e->bits = TYPE_Nm | TYPE_Nd; -- cgit v1.2.3