summaryrefslogtreecommitdiffstats
path: root/mansearch.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-11-06 21:19:09 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-11-06 21:19:09 +0000
commit6924ae48b47711b9da4b5c7bd333a04e7110238e (patch)
tree7add078a2d9d49000c3608b308784d132b99b5ab /mansearch.c
parent76c7674a39f6ce0879ba3aa3140b438db94473e2 (diff)
downloadmandoc-6924ae48b47711b9da4b5c7bd333a04e7110238e.tar.gz
In ./configure, select a RE syntax for word boundaries supported by libc;
issue reported by Svyatoslav Mishyn, Peter Bray, and Daniel Levai.
Diffstat (limited to 'mansearch.c')
-rw-r--r--mansearch.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mansearch.c b/mansearch.c
index e825c13b..1b37abf1 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -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;