diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2006-02-13 22:09:26 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2006-02-13 22:09:26 +0000 |
commit | 50b0e0be2ce1ad30bd4ac60ac5b65375f7d27180 (patch) | |
tree | 09f7a6d5d9cf4bd50e459e952cebff5dbfdff6d7 /usr.bin/column/column.c | |
parent | 279b470f551c62df07a123c040408583156bdaf0 (diff) | |
download | FreeBSD-src-50b0e0be2ce1ad30bd4ac60ac5b65375f7d27180.zip FreeBSD-src-50b0e0be2ce1ad30bd4ac60ac5b65375f7d27180.tar.gz |
The change to make column use roundup(x, TAB) rounded things to the
current tab, however the code it replaced wanted to round to the
next TAB. Consequently things like this:
( echo 1 ; echo 2 ) | column
cause column to loop indefinitely. This patch is slightly different
from the one Gary submitted, but is closer to the original code.
Submitted by: Gary Cody <gary@lyranthe.org>
MFC after: 1 week
Diffstat (limited to 'usr.bin/column/column.c')
-rw-r--r-- | usr.bin/column/column.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/column/column.c b/usr.bin/column/column.c index 4ac5b24..ccaa824 100644 --- a/usr.bin/column/column.c +++ b/usr.bin/column/column.c @@ -141,7 +141,7 @@ main(int argc, char **argv) if (!entries) exit(eval); - maxlength = roundup(maxlength, TAB); + maxlength = roundup(maxlength + TAB, TAB); if (tflag) maketbl(); else if (maxlength >= termwidth) @@ -171,7 +171,7 @@ c_columnate(void) endcol = maxlength; putwchar('\n'); } else { - while ((cnt = roundup(chcnt, TAB)) <= endcol) { + while ((cnt = roundup(chcnt + TAB, TAB)) <= endcol) { (void)putwchar('\t'); chcnt = cnt; } @@ -199,7 +199,7 @@ r_columnate(void) chcnt += width(list[base]); if ((base += numrows) >= entries) break; - while ((cnt = roundup(chcnt, TAB)) <= endcol) { + while ((cnt = roundup(chcnt + TAB, TAB)) <= endcol) { (void)putwchar('\t'); chcnt = cnt; } |