summaryrefslogtreecommitdiff
path: root/src/csplit.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-11-23 02:32:10 +0000
committerJim Meyering <jim@meyering.net>1996-11-23 02:32:10 +0000
commit0d3f6a66654c917d07878257cb3c9391f9e85694 (patch)
tree9f877f1830eb26704d71d90c1e945980e1ace8de /src/csplit.c
parentaa00ea2e8848b8568b8ef5c9739451cfccfbbea8 (diff)
downloadcoreutils-0d3f6a66654c917d07878257cb3c9391f9e85694.tar.xz
(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.
Diffstat (limited to 'src/csplit.c')
-rw-r--r--src/csplit.c3
1 files changed, 2 insertions, 1 deletions
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. */