=================================================================== RCS file: /cvs/mandoc/mansearch.c,v retrieving revision 1.60 retrieving revision 1.62 diff -u -p -r1.60 -r1.62 --- mandoc/mansearch.c 2015/10/13 15:53:05 1.60 +++ mandoc/mansearch.c 2015/11/07 14:22:29 1.62 @@ -1,4 +1,4 @@ -/* $Id: mansearch.c,v 1.60 2015/10/13 15:53:05 schwarze Exp $ */ +/* $Id: mansearch.c,v 1.62 2015/11/07 14:22:29 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015 Ingo Schwarze @@ -21,7 +21,9 @@ #include #include +#if HAVE_ERR #include +#endif #include #include #include @@ -766,7 +768,14 @@ exprterm(const struct mansearch *search, char *buf, in 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;