tgrep: import $ fix from plan 9 - plan9port - [fork] Plan 9 from user space (HTM) git clone git://src.adamsgaard.dk/plan9port (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit ce5fdeb4469ecc6967d09d0aea9d29babb1ab5fc (DIR) parent 29fba8562cd8585a613046b509347c905642be16 (HTM) 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(-) --- (DIR) diff --git a/src/cmd/grep/comp.c b/src/cmd/grep/comp.c t@@ -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: