]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(unexpand): Fix bug that contributed to endless loop
authorJim Meyering <jim@meyering.net>
Sun, 14 Jul 1996 22:24:28 +0000 (22:24 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 14 Jul 1996 22:24:28 +0000 (22:24 +0000)
when invoking `echo '  ' |unexpand -t 1,2': use print_tab_index, not
tab_index in inner flush_pend: while loop.  From Keith Owens
<kaos@audio.apana.org.au>.

src/unexpand.c

index 1fbda7fc8e01420043d7acd2774d80f1fbcca28a..f5c91c00d5ae00642aa35f1b31d20f7162cc937e 100644 (file)
@@ -290,10 +290,10 @@ unexpand (void)
            {
              if (tab_size == 0)
                {
-                 /* Do not let tab_index == first_free_tab;
+                 /* Do not let print_tab_index == first_free_tab;
                     stop when it is 1 less. */
-                 while (tab_index < first_free_tab - 1
-                        && column >= tab_list[tab_index])
+                 while (print_tab_index < first_free_tab - 1
+                        && column >= tab_list[print_tab_index])
                    print_tab_index++;
                  next_tab_column = tab_list[print_tab_index];
                  if (print_tab_index < first_free_tab - 1)