diff options
author | robert <robert@FreeBSD.org> | 2003-03-13 23:32:28 +0000 |
---|---|---|
committer | robert <robert@FreeBSD.org> | 2003-03-13 23:32:28 +0000 |
commit | 0ddc4b17e7abc81a103d45cac7cff2cf55b25d66 (patch) | |
tree | 7ef3584e3d42073e216cde88c80a8ac51e19b5ff /usr.bin/cksum/print.c | |
parent | 2939d783ece3a33d37be2601d6d3937a31059179 (diff) | |
download | FreeBSD-src-0ddc4b17e7abc81a103d45cac7cff2cf55b25d66.zip FreeBSD-src-0ddc4b17e7abc81a103d45cac7cff2cf55b25d66.tar.gz |
- For variables holding offset values, use off_t rather than
int, long int or u_int32_t. This changes the interface of
all the CRC calculation and output functions from cksum.
- Print variables of type off_t as intmax_t using a cast and %jd.
- Use the standardized uint32_t type instead of u_int32_t.
To have uint32_t defined, include <stdint.h> where necessary.
Style(9):
- Move #include directives where they belong (esp. crc32.c).
- Add empty lines between #include directives of system headers,
standard library headers and local headers.
- Test a pointer value against NULL.
- Put a space after the return keyword.
PR: bin/48424
Diffstat (limited to 'usr.bin/cksum/print.c')
-rw-r--r-- | usr.bin/cksum/print.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/usr.bin/cksum/print.c b/usr.bin/cksum/print.c index e23d084..1cc27646 100644 --- a/usr.bin/cksum/print.c +++ b/usr.bin/cksum/print.c @@ -36,36 +36,40 @@ static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 6/6/93"; #endif #endif /* not lint */ + #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include <sys/types.h> + #include <stdio.h> +#include <stdint.h> + #include "extern.h" void -pcrc(char *fn, u_int32_t val, u_int32_t len) +pcrc(char *fn, uint32_t val, off_t len) { - (void)printf("%lu %lu", (u_long) val, (u_long) len); - if (fn) + (void)printf("%lu %jd", (u_long)val, (intmax_t)len); + if (fn != NULL) (void)printf(" %s", fn); (void)printf("\n"); } void -psum1(char *fn, u_int32_t val, u_int32_t len) +psum1(char *fn, uint32_t val, off_t len) { - (void)printf("%lu %lu", (u_long) val, (u_long) (len + 1023) / 1024); - if (fn) + (void)printf("%lu %jd", (u_long)val, (intmax_t)(len + 1023) / 1024); + if (fn != NULL) (void)printf(" %s", fn); (void)printf("\n"); } void -psum2(char *fn, u_int32_t val, u_int32_t len) +psum2(char *fn, uint32_t val, off_t len) { - (void)printf("%lu %lu", (u_long) val, (u_long) (len + 511) / 512); - if (fn) + (void)printf("%lu %jd", (u_long)val, (intmax_t)(len + 511) / 512); + if (fn != NULL) (void)printf(" %s", fn); (void)printf("\n"); } |