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:
parent
e91d94a70e
commit
2ba7005ddd
4
grep.c
4
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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user