Artifact 0b7c96ced1514b3bb23a08ab235801a28399c425:
- File work/test.c — part of check-in [fa46591195] at 2004-04-14 17:14:01 on branch trunk — DACT is now 64-bit filesize friendly.. I hope. I changed the CRC algorithm to Adler32, and added a check for old versions of DACT to use the old CRC algorithm. I renamed stdint.h to dact_stdint.h (though this file isn't used anymore?) I changed the old CRC algorithm function from `ELFCRC' to `elfcrc' (user: rkeene size: 477)
#include <stdint.h> #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <stdlib.h> #include <sys/stat.h> #include <fcntl.h> #include "crc.h" int main(int argc, char **argv) { uint32_t crcval=0; int fd; char *buf; int buflen=1024; int x; buflen=atoi(argv[1]); buf=malloc(buflen); fd=open(argv[2], O_RDONLY); while (1) { x=read(fd, buf, buflen); if (x<=0) break; crcval=crc(crcval, buf, x); } printf("adler32=%08x\n", crcval); return(0); }