diff options
author | jmallett <jmallett@FreeBSD.org> | 2005-01-25 01:35:02 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2005-01-25 01:35:02 +0000 |
commit | d4c73463ce910531762b5fad80a2660d04dbd047 (patch) | |
tree | 26fba3a42b537632ba6560e54d3e993231f47684 /usr.bin/column | |
parent | 32b3eaa1c223378ae1ccb8a55f146356bf59bcf3 (diff) | |
download | FreeBSD-src-d4c73463ce910531762b5fad80a2660d04dbd047.zip FreeBSD-src-d4c73463ce910531762b5fad80a2660d04dbd047.tar.gz |
Take a swing at using roundup().
Diffstat (limited to 'usr.bin/column')
-rw-r--r-- | usr.bin/column/column.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/column/column.c b/usr.bin/column/column.c index 1082f57..4ac5b24 100644 --- a/usr.bin/column/column.c +++ b/usr.bin/column/column.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <sys/ioctl.h> +#include <sys/param.h> #include <err.h> #include <limits.h> @@ -140,7 +141,7 @@ main(int argc, char **argv) if (!entries) exit(eval); - maxlength = (maxlength + TAB) & ~(TAB - 1); + maxlength = roundup(maxlength, TAB); if (tflag) maketbl(); else if (maxlength >= termwidth) @@ -170,7 +171,7 @@ c_columnate(void) endcol = maxlength; putwchar('\n'); } else { - while ((cnt = ((chcnt + TAB) & ~(TAB - 1))) <= endcol) { + while ((cnt = roundup(chcnt, TAB)) <= endcol) { (void)putwchar('\t'); chcnt = cnt; } @@ -198,7 +199,7 @@ r_columnate(void) chcnt += width(list[base]); if ((base += numrows) >= entries) break; - while ((cnt = ((chcnt + TAB) & ~(TAB - 1))) <= endcol) { + while ((cnt = roundup(chcnt, TAB)) <= endcol) { (void)putwchar('\t'); chcnt = cnt; } |