diff options
-rw-r--r-- | src/cmd/grep/comp.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cmd/grep/comp.c b/src/cmd/grep/comp.c index c3e1549a..241a4136 100644 --- a/src/cmd/grep/comp.c +++ b/src/cmd/grep/comp.c @@ -114,8 +114,14 @@ loop: break; case Tend: - if(c == '\n') - matched = 1; + if(c == '\n') { + if(r->next == 0) { + matched = 1; + break; + } + r = r->next; + goto loop; + } break; case Tclass: |