From 167c036e91fb24a62d627d16a2f3afa6d875c9e2 Mon Sep 17 00:00:00 2001 From: archie Date: Sun, 6 Dec 1998 22:58:23 +0000 Subject: Tweaks to allow compiling -Wall (mostly adding "const" to char rcsid[]). --- usr.bin/column/Makefile | 1 + usr.bin/column/column.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'usr.bin/column') diff --git a/usr.bin/column/Makefile b/usr.bin/column/Makefile index 1c304e2..33de9f6 100644 --- a/usr.bin/column/Makefile +++ b/usr.bin/column/Makefile @@ -1,5 +1,6 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= column +CFLAGS+=-Wall .include diff --git a/usr.bin/column/column.c b/usr.bin/column/column.c index cf8c7a9..043ab9d 100644 --- a/usr.bin/column/column.c +++ b/usr.bin/column/column.c @@ -32,13 +32,13 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1989, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)column.c 8.4 (Berkeley) 5/4/95"; +static const char sccsid[] = "@(#)column.c 8.4 (Berkeley) 5/4/95"; #endif /* not lint */ #include @@ -79,7 +79,7 @@ main(argc, argv) char *p; if (ioctl(1, TIOCGWINSZ, &win) == -1 || !win.ws_col) { - if (p = getenv("COLUMNS")) + if ((p = getenv("COLUMNS"))) termwidth = atoi(p); } else termwidth = win.ws_col; @@ -109,7 +109,7 @@ main(argc, argv) if (!*argv) input(stdin); else for (; *argv; ++argv) - if (fp = fopen(*argv, "r")) { + if ((fp = fopen(*argv, "r"))) { input(fp); (void)fclose(fp); } else { @@ -150,7 +150,7 @@ c_columnate() endcol = maxlength; putchar('\n'); } else { - while ((cnt = (chcnt + TAB & ~(TAB - 1))) <= endcol) { + while ((cnt = ((chcnt + TAB) & ~(TAB - 1))) <= endcol) { (void)putchar('\t'); chcnt = cnt; } @@ -178,7 +178,7 @@ r_columnate() chcnt += printf("%s", list[base]); if ((base += numrows) >= entries) break; - while ((cnt = (chcnt + TAB & ~(TAB - 1))) <= endcol) { + while ((cnt = ((chcnt + TAB) & ~(TAB - 1))) <= endcol) { (void)putchar('\t'); chcnt = cnt; } @@ -218,7 +218,7 @@ maketbl() 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); + for (coloff = 0, p = *lp; (cols[coloff] = strtok(p, separator)); p = NULL) if (++coloff == maxcols) { if (!(cols = realloc(cols, (u_int)maxcols + -- cgit v1.1