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

musl doesn't seem to support the latter, so use the older SVR4
word delimiters.
This commit is contained in:
sin 2015-01-22 17:37:52 +00:00
parent e91d94a70e
commit 2ba7005ddd

4
grep.c
View File

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