1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-07-29 11:59:36 +02:00

The command, `yes ''|./cat -n' would stop printing after INT_MAX lines.

(cat): Never let `newlines' exceed 3.
This commit is contained in:
Jim Meyering
2000-10-21 19:57:41 +00:00
parent 51e2ffc524
commit 13e80acf07
+14 -6
View File
@@ -350,13 +350,21 @@ cat (
if (++newlines > 0)
{
/* Are multiple adjacent empty lines to be substituted by
single ditto (-s), and this was the second empty line? */
if (squeeze_empty_lines && newlines >= 2)
if (newlines >= 2)
{
ch = *bpin++;
continue;
/* Limit this to 2 here. Otherwise, with lots of
consecutive newlines, the counter could wrap
around at INT_MAX. */
newlines = 2;
/* Are multiple adjacent empty lines to be substituted
by single ditto (-s), and this was the second empty
line? */
if (squeeze_empty_lines)
{
ch = *bpin++;
continue;
}
}
/* Are line numbers to be written at empty lines (-n)? */