diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-11-06 21:19:09 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-11-06 21:19:09 +0000 |
commit | d53a7449dca8ec558ca0b6c322c6d3351afe1c8b (patch) | |
tree | aa97bd8599814cfda433c5aa309a38be0804f4e2 /mansearch.c | |
parent | 7ab4e1278a5b8ac4289c450b2bf85da2aad06ba4 (diff) | |
download | mandoc-d53a7449dca8ec558ca0b6c322c6d3351afe1c8b.tar.gz mandoc-d53a7449dca8ec558ca0b6c322c6d3351afe1c8b.tar.zst mandoc-d53a7449dca8ec558ca0b6c322c6d3351afe1c8b.zip |
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.c | 9 |
1 files changed, 8 insertions, 1 deletions
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 <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -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; |