]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(process_regexp): Update CURRENT_LINE only if
authorJim Meyering <jim@meyering.net>
Sat, 23 Nov 1996 02:32:10 +0000 (02:32 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 23 Nov 1996 02:32:10 +0000 (02:32 +0000)
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.

src/csplit.c

index b8713fe69518d73a72bf6022eb869468f1de0650..e3de13a0f7c4f9322a257ef034795e1d2266dbd2 100644 (file)
@@ -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. */