home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
APPS
/
macutils.lzh
/
MACUTILS
/
HEXBIN
/
crc.c
< prev
next >
Wrap
Text File
|
1996-02-01
|
780b
|
46 lines
/* crc.c; do crc calculation. */
#ifndef OSK
#include <stdio.h>
#endif
#include "hexbin.h"
#include "crc.h"
#include "../util/masks.h"
#include "globals.h"
extern void exit();
unsigned long _crc;
#ifdef HQX
void comp_q_crc(c)
register unsigned int c;
{
unsigned char cc = c;
_crc = binhex_updcrc(_crc, &cc, 1);
}
void comp_q_crc_n(s, e)
register unsigned char *s, *e;
{
_crc = binhex_updcrc(_crc, s, e - s);
}
#endif /* HQX */
void verify_crc(calc_crc, file_crc)
unsigned long calc_crc, file_crc;
{
calc_crc &= WORDMASK;
file_crc &= WORDMASK;
if(calc_crc != file_crc) {
(void)fprintf(stderr, "CRC mismatch: got 0x%04lx, need 0x%04lx\n",
file_crc, calc_crc);
#ifdef SCAN
do_error("hexbin: CRC error");
#endif /* SCAN */
exit(1);
}
}