commit ce5fdeb4469ecc6967d09d0aea9d29babb1ab5fc parent 29fba8562cd8585a613046b509347c905642be16 Author: Russ Cox <rsc@swtch.com> Date: Sun, 10 Jul 2011 20:01:15 -0400 grep: import $ fix from plan 9 R=rsc http://codereview.appspot.com/4673053 Diffstat:
M | src/cmd/grep/comp.c | | | 10 | ++++++++-- |
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git 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: