=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/column/column.c,v retrieving revision 1.5 retrieving revision 1.6 diff -c -r1.5 -r1.6 *** src/usr.bin/column/column.c 1999/12/09 00:48:03 1.5 --- src/usr.bin/column/column.c 2001/07/12 05:16:59 1.6 *************** *** 1,4 **** ! /* $OpenBSD: column.c,v 1.5 1999/12/09 00:48:03 millert Exp $ */ /* $NetBSD: column.c,v 1.4 1995/09/02 05:53:03 jtc Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: column.c,v 1.6 2001/07/12 05:16:59 deraadt Exp $ */ /* $NetBSD: column.c,v 1.4 1995/09/02 05:53:03 jtc Exp $ */ /* *************** *** 44,50 **** #if 0 static char sccsid[] = "@(#)column.c 8.4 (Berkeley) 5/4/95"; #endif ! static char rcsid[] = "$OpenBSD: column.c,v 1.5 1999/12/09 00:48:03 millert Exp $"; #endif /* not lint */ #include --- 44,50 ---- #if 0 static char sccsid[] = "@(#)column.c 8.4 (Berkeley) 5/4/95"; #endif ! static char rcsid[] = "$OpenBSD: column.c,v 1.6 2001/07/12 05:16:59 deraadt Exp $"; #endif /* not lint */ #include *************** *** 85,91 **** char *p; if (ioctl(1, TIOCGWINSZ, &win) == -1 || !win.ws_col) { ! if (p = getenv("COLUMNS")) termwidth = atoi(p); } else termwidth = win.ws_col; --- 85,91 ---- char *p; if (ioctl(1, TIOCGWINSZ, &win) == -1 || !win.ws_col) { ! if ((p = getenv("COLUMNS"))) termwidth = atoi(p); } else termwidth = win.ws_col; *************** *** 115,121 **** if (!*argv) input(stdin); else for (; *argv; ++argv) ! if (fp = fopen(*argv, "r")) { input(fp); (void)fclose(fp); } else { --- 115,121 ---- if (!*argv) input(stdin); else for (; *argv; ++argv) ! if ((fp = fopen(*argv, "r"))) { input(fp); (void)fclose(fp); } else { *************** *** 156,162 **** endcol = maxlength; putchar('\n'); } else { ! while ((cnt = (chcnt + TAB & ~(TAB - 1))) <= endcol) { (void)putchar('\t'); chcnt = cnt; } --- 156,162 ---- endcol = maxlength; putchar('\n'); } else { ! while ((cnt = ((chcnt + TAB) & ~(TAB - 1))) <= endcol) { (void)putchar('\t'); chcnt = cnt; } *************** *** 186,192 **** chcnt += printf("%s", list[base]); if ((base += numrows) >= entries) break; ! while ((cnt = (chcnt + TAB & ~(TAB - 1))) <= endcol) { (void)putchar('\t'); chcnt = cnt; } --- 186,192 ---- chcnt += printf("%s", list[base]); if ((base += numrows) >= entries) break; ! while ((cnt = ((chcnt + TAB) & ~(TAB - 1))) <= endcol) { (void)putchar('\t'); chcnt = cnt; } *************** *** 226,232 **** cols = emalloc((maxcols = DEFCOLS) * sizeof(char *)); lens = emalloc(maxcols * sizeof(int)); for (cnt = 0, lp = list; cnt < entries; ++cnt, ++lp, ++t) { ! for (coloff = 0, p = *lp; cols[coloff] = strtok(p, separator); p = NULL) if (++coloff == maxcols) { if (!(cols = realloc(cols, (u_int)maxcols + --- 226,232 ---- cols = emalloc((maxcols = DEFCOLS) * sizeof(char *)); lens = emalloc(maxcols * sizeof(int)); for (cnt = 0, lp = list; cnt < entries; ++cnt, ++lp, ++t) { ! for (coloff = 0, p = *lp; (cols[coloff] = strtok(p, separator)); p = NULL) if (++coloff == maxcols) { if (!(cols = realloc(cols, (u_int)maxcols +