From 6ca5ece2c9e88eace10e40a733c301db69e331cc Mon Sep 17 00:00:00 2001 From: markm Date: Sun, 2 Dec 2001 12:54:40 +0000 Subject: [PATCH] WARNS=2 fixup. kill 'register' keyword. --- usr.bin/cksum/Makefile | 3 ++- usr.bin/cksum/cksum.c | 2 +- usr.bin/cksum/crc.c | 18 ++++++++++-------- usr.bin/cksum/crc32.c | 10 ++++++---- usr.bin/cksum/extern.h | 1 + usr.bin/cksum/sum1.c | 22 ++++++++++++---------- usr.bin/cksum/sum2.c | 22 ++++++++++++---------- 7 files changed, 44 insertions(+), 34 deletions(-) diff --git a/usr.bin/cksum/Makefile b/usr.bin/cksum/Makefile index 4c1d027c04b0..1da732b016b6 100644 --- a/usr.bin/cksum/Makefile +++ b/usr.bin/cksum/Makefile @@ -1,8 +1,9 @@ # @(#)Makefile 8.2 (Berkeley) 4/28/95 +# $FreeBSD$ PROG= cksum -CFLAGS+=-Wall SRCS= cksum.c crc.c print.c sum1.c sum2.c crc32.c +WARNS?= 2 LINKS= ${BINDIR}/cksum ${BINDIR}/sum MLINKS= cksum.1 sum.1 diff --git a/usr.bin/cksum/cksum.c b/usr.bin/cksum/cksum.c index d89f07fa9ac2..bd75151162d7 100644 --- a/usr.bin/cksum/cksum.c +++ b/usr.bin/cksum/cksum.c @@ -66,7 +66,7 @@ main(argc, argv) int argc; char **argv; { - register int ch, fd, rval; + int ch, fd, rval; u_int32_t len, val; char *fn, *p; int (*cfncn) __P((int, u_int32_t *, u_int32_t *)); diff --git a/usr.bin/cksum/crc.c b/usr.bin/cksum/crc.c index 1dc0293447a9..ba436601c711 100644 --- a/usr.bin/cksum/crc.c +++ b/usr.bin/cksum/crc.c @@ -45,6 +45,8 @@ static const char rcsid[] = #include #include +#include "extern.h" + static const u_int32_t crctab[] = { 0x0, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, @@ -110,21 +112,21 @@ u_int32_t crc_total = ~0; /* The crc over a number of files. */ int crc(fd, cval, clen) - register int fd; + int fd; u_int32_t *cval, *clen; { - register u_char *p; - register int nr; - register u_int32_t crc, len; + u_char *p; + int nr; + u_int32_t lcrc, len; u_char buf[16 * 1024]; #define COMPUTE(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)] - crc = len = 0; + lcrc = len = 0; crc_total = ~crc_total; while ((nr = read(fd, buf, sizeof(buf))) > 0) for (len += nr, p = buf; nr--; ++p) { - COMPUTE(crc, *p); + COMPUTE(lcrc, *p); COMPUTE(crc_total, *p); } if (nr < 0) @@ -134,11 +136,11 @@ crc(fd, cval, clen) /* Include the length of the file. */ for (; len != 0; len >>= 8) { - COMPUTE(crc, len & 0xff); + COMPUTE(lcrc, len & 0xff); COMPUTE(crc_total, len & 0xff); } - *cval = ~crc; + *cval = ~lcrc; crc_total = ~crc_total; return (0); } diff --git a/usr.bin/cksum/crc32.c b/usr.bin/cksum/crc32.c index ae49a834ecfc..f290d69e6339 100644 --- a/usr.bin/cksum/crc32.c +++ b/usr.bin/cksum/crc32.c @@ -18,6 +18,8 @@ static const char rcsid[] = #include +#include "extern.h" + #define CRC(crc, ch) (crc = (crc >> 8) ^ crctab[(crc ^ (ch)) & 0xff]) /* generated using the AUTODIN II polynomial @@ -99,10 +101,10 @@ u_int32_t crc32_total = 0 ; int crc32(fd, cval, clen) - register int fd; + int fd; u_int32_t *cval, *clen; { - u_int32_t crc = ~0; + u_int32_t lcrc = ~0; char buf[BUFSIZ], *p ; int len, nr ; @@ -110,14 +112,14 @@ crc32(fd, cval, clen) crc32_total = ~crc32_total ; while ((nr = read(fd, buf, sizeof(buf))) > 0) for (len += nr, p = buf; nr--; ++p) { - CRC(crc, *p) ; + CRC(lcrc, *p) ; CRC(crc32_total, *p) ; } if (nr < 0) return 1 ; *clen = len ; - *cval = ~crc ; + *cval = ~lcrc ; crc32_total = ~crc32_total ; return 0 ; } diff --git a/usr.bin/cksum/extern.h b/usr.bin/cksum/extern.h index cee3f242448c..ab1ee7319b2d 100644 --- a/usr.bin/cksum/extern.h +++ b/usr.bin/cksum/extern.h @@ -31,6 +31,7 @@ * SUCH DAMAGE. * * @(#)extern.h 8.1 (Berkeley) 6/6/93 + * $FreeBSD$ */ #include diff --git a/usr.bin/cksum/sum1.c b/usr.bin/cksum/sum1.c index bcdeb30df5a7..aaba1e8cbccd 100644 --- a/usr.bin/cksum/sum1.c +++ b/usr.bin/cksum/sum1.c @@ -42,32 +42,34 @@ static const char rcsid[] = #include #include +#include "extern.h" + int csum1(fd, cval, clen) - register int fd; + int fd; u_int32_t *cval, *clen; { - register u_int32_t total; - register int nr; - register u_int crc; - register u_char *p; + u_int32_t total; + int nr; + u_int lcrc; + u_char *p; u_char buf[8192]; /* * 16-bit checksum, rotating right before each addition; * overflow is discarded. */ - crc = total = 0; + lcrc = total = 0; while ((nr = read(fd, buf, sizeof(buf))) > 0) for (total += nr, p = buf; nr--; ++p) { - if (crc & 1) - crc |= 0x10000; - crc = ((crc >> 1) + *p) & 0xffff; + if (lcrc & 1) + lcrc |= 0x10000; + lcrc = ((lcrc >> 1) + *p) & 0xffff; } if (nr < 0) return(1); - *cval = crc; + *cval = lcrc; *clen = total; return(0); } diff --git a/usr.bin/cksum/sum2.c b/usr.bin/cksum/sum2.c index 4ce83f615cfd..a14c4d323ba1 100644 --- a/usr.bin/cksum/sum2.c +++ b/usr.bin/cksum/sum2.c @@ -42,14 +42,16 @@ static const char rcsid[] = #include #include +#include "extern.h" + int csum2(fd, cval, clen) - register int fd; + int fd; u_int32_t *cval, *clen; { - register u_int32_t crc, total; - register int nr; - register u_char *p; + u_int32_t lcrc, total; + int nr; + u_char *p; u_char buf[8192]; /* @@ -57,19 +59,19 @@ csum2(fd, cval, clen) * * s = sum of all bytes * r = s % 2^16 + (s % 2^32) / 2^16 - * crc = (r % 2^16) + r / 2^16 + * lcrc = (r % 2^16) + r / 2^16 */ - crc = total = 0; + lcrc = total = 0; while ((nr = read(fd, buf, sizeof(buf))) > 0) for (total += nr, p = buf; nr--; ++p) - crc += *p; + lcrc += *p; if (nr < 0) return(1); - crc = (crc & 0xffff) + (crc >> 16); - crc = (crc & 0xffff) + (crc >> 16); + lcrc = (lcrc & 0xffff) + (lcrc >> 16); + lcrc = (lcrc & 0xffff) + (lcrc >> 16); - *cval = crc; + *cval = lcrc; *clen = total; return(0); }