From: Jim Meyering Date: Sat, 23 Nov 1996 02:32:10 +0000 (+0000) Subject: (process_regexp): Update CURRENT_LINE only if X-Git-Tag: TEXTUTILS-1_19q~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d3f6a66654c917d07878257cb3c9391f9e85694;p=thirdparty%2Fcoreutils.git (process_regexp): Update CURRENT_LINE only if the new value would be larger. This avoids the infinite loop otherwise provoked by situations like this: printf "\na\n" | csplit - '/a/-1' '{*}' From Jens Schmidt. --- diff --git a/src/csplit.c b/src/csplit.c index b8713fe695..e3de13a0f7 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -972,7 +972,8 @@ process_regexp (struct control *p, int repetition) if (!ignore) close_output_file (); - current_line = break_line; + if (p->offset > 0) + current_line = break_line; } /* Split the input file according to the control records we have built. */