]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(close_file): Reverse May 13, '92 change, but add the condition
authorJim Meyering <jim@meyering.net>
Mon, 22 Mar 1993 04:39:25 +0000 (04:39 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 22 Mar 1993 04:39:25 +0000 (04:39 +0000)
that cols_ready_to_print not be decremented when printing across.
The command `echo |pr -2ta' didn't terminate.
(print_page): Rewrite conditional with side effects in second conjunct
using nested if statements to make it clear that we do indeed want
those semantics.

src/pr.c

index 1abb686bbd97ee57ed051ab145687c59189bf259..bf4517d2ae7510cadb8472c9b6310cda7b4ba6f1 100644 (file)
--- a/src/pr.c
+++ b/src/pr.c
@@ -919,10 +919,8 @@ close_file (p)
          q->status = CLOSED;
          if (q->lines_stored == 0)
            {
-#if 0
-             if (cols_ready_to_print > 0)
+             if (cols_ready_to_print > 0 && !print_across_flag)
                --cols_ready_to_print;
-#endif
              q->lines_to_print = 0;
            }
        }
@@ -1180,8 +1178,13 @@ print_page ()
              if (use_column_separator)
                ++separators_not_printed;
 
-             if (--p->lines_to_print <= 0 && --cols_ready_to_print <= 0)
-               break;
+             --p->lines_to_print;
+             if (p->lines_to_print <= 0)
+               {
+                 --cols_ready_to_print;
+                 if (cols_ready_to_print <= 0)
+                   break;
+               }
            }
        }