From 0d3f6a66654c917d07878257cb3c9391f9e85694 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 23 Nov 1996 02:32:10 +0000 Subject: (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. --- src/csplit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/csplit.c b/src/csplit.c index b8713fe69..e3de13a0f 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. */ -- cgit v1.2.3-54-g00ecf