sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 2ba7005dddc824d5967a78c596d89c214175eb6f
parent e91d94a70eae0799b7e0b6364767b212455d04c8
Author: sin <sin@2f30.org>
Date:   Thu, 22 Jan 2015 17:37:52 +0000

Use \< and \> instead of [[:<:]] and [[:>:]]

musl doesn't seem to support the latter, so use the older SVR4
word delimiters.

Diffstat:
Mgrep.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grep.c b/grep.c @@ -170,7 +170,7 @@ addpattern(const char *pattern) pattern, pattern[strlen(pattern) - 1] == '$' ? "" : "$"); } else if (!Fflag && wflag) { - len = strlen(pattern) + 15 + (Eflag ? 2 : 4); + len = strlen(pattern) + 5 + (Eflag ? 2 : 4); tmp = malloc(len); if (!tmp) enprintf(Error, "malloc:"); @@ -181,7 +181,7 @@ addpattern(const char *pattern) if (pattern[strlen(pattern) - 1] == '$') eol = 1; - snprintf(tmp, len, "%s[[:<:]]%s%.*s%s[[:>:]]%s", + snprintf(tmp, len, "%s\\<%s%.*s%s\\>%s", bol ? "^" : "", Eflag ? "(" : "\\(", (int)strlen(pattern) - bol - eol, pattern + bol,