diff options
Diffstat (limited to 'usr.bin/grep/util.c')
-rw-r--r-- | usr.bin/grep/util.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index 758270d..683a537 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -309,7 +309,9 @@ procline(struct str *l, int nottext) r = regexec(&r_pattern[i], l->dat, 1, &pmatch, eflags); r = (r == 0) ? 0 : REG_NOMATCH; - st = pmatch.rm_eo; + st = (cflags & REG_NOSUB) + ? (size_t)l->len + : (size_t)pmatch.rm_eo; if (r == REG_NOMATCH) continue; /* Check for full match */ |