Annotation of libelwix/example/test_crc.c, revision 1.1.2.1
1.1.2.1 ! misho 1: #include <stdio.h>
! 2: #include <sys/types.h>
! 3: #include <elwix.h>
! 4:
! 5:
! 6: int
! 7: main(int argc, char **argv)
! 8: {
! 9: FILE *f;
! 10: char line[BUFSIZ] = { 0 };
! 11:
! 12: if(argc < 2)
! 13: return 1;
! 14:
! 15: f = fopen(argv[1], "r");
! 16: if (!f)
! 17: return 1;
! 18:
! 19: while (fgets(line, sizeof line - 1, f)) {
! 20: printf("crc16-ccitt %x init(0xFFFF) %x init(0x1d0f) %x\n", crc_16_ccitt(line, strlen(line)),
! 21: crcCalc(line, strlen(line), 161, 0, 0xFFFF, 0x0),
! 22: crcCalc(line, strlen(line), 161, 0, 0x1D0F, 0x0));
! 23: printf("crc16 %x vs ccitt %x crc16_xy %x crc_16_xmodem %x\n", crc_16(line, strlen(line)), crc16_ccitt(line, strlen(line)),
! 24: crc16_xy(line, strlen(line)), crc_16_xmodem(line, strlen(line)));
! 25: printf("crc32 %x vs %x\n", crc_32(line, strlen(line)), crc32tbl(0, line, strlen(line)));
! 26: }
! 27:
! 28: fclose(f);
! 29: return 0;
! 30: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>