[hackers] [sbase] Use \< and \> instead of [[:<:]] and [[:>:]] || sin

From: <git_AT_suckless.org>
Date: Thu, 22 Jan 2015 18:39:59 +0100 (CET)

commit d134fe65ab69aa2518664abe2dcffdca6ed43f49
Author: sin <sin_AT_2f30.org>
Date: Thu Jan 22 17:37:52 2015 +0000

    Use \< and \> instead of [[:<:]] and [[:>:]]
    
    musl doesn't seem to support the latter, so use the older SVR4
    word delimiters.

diff --git a/grep.c b/grep.c
index 7b932ca..6f6927e 100644
--- a/grep.c
+++ b/grep.c
_AT_@ -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:");
_AT_@ -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,
Received on Thu Jan 22 2015 - 18:39:59 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 22 2015 - 18:48:09 CET