diff options
author | Jim Meyering <jim@meyering.net> | 1996-11-23 02:32:10 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1996-11-23 02:32:10 +0000 |
commit | 0d3f6a66654c917d07878257cb3c9391f9e85694 (patch) | |
tree | 9f877f1830eb26704d71d90c1e945980e1ace8de | |
parent | aa00ea2e8848b8568b8ef5c9739451cfccfbbea8 (diff) | |
download | coreutils-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.
-rw-r--r-- | src/csplit.c | 3 |
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. */ |