aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/posix/grep.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/toys/posix/grep.c b/toys/posix/grep.c
index 4338a552..8877f452 100644
--- a/toys/posix/grep.c
+++ b/toys/posix/grep.c
@@ -212,7 +212,8 @@ static void parse_regex(void)
// Convert strings to one big regex
if (w) len = 36;
- for (al = TT.e; al; al = al->next) len += strlen(al->arg)+1;
+ for (al = TT.e; al; al = al->next)
+ len += strlen(al->arg)+1+!(toys.optflags & FLAG_E);
regstr = s = xmalloc(len);
if (w) s = stpcpy(s, "(^|[^_[:alnum:]])(");