Help with C-kermit on SCO Xenix V
Chuck Forsberg WA7KGX
caf at omen.UUCP
Wed Apr 30 21:52:42 AEST 1986
In article <294 at catnip.UUCP> ben at catnip.UUCP (Bennett Broder) writes:
>I recent obtained a copy of C-kermit 4.2(030) PRERELEASE #2, 5 March 85.
>We have been using this version at work on a Perkin Elmer 3250XP and an
>AT&T 3B5, and so I wasn't expecting any problem bringing it up on Xenix.
>Well the package compiles without error, and appears to work okay, until
>you attempt to do a transfer. Then it can't even seem to get past the
>header packet, and keeps printing SS%S%S%S%S% and the like on the screen.
>Looking at the debugging output from both ends show that the Xenix machine
>is computing the checksum incorrectly. Please, can anyone help???
>
The Microsoft C compiler has a few problems with right shifts such as used
in the Kermit CRC calculations. Here is something that should work better.
(From Professional-YAM, the most powerful COMM program for the PC)
/* C H K 1 -- Compute a type-1 Kermit 6-bit checksum. */
chk1(pkt)
char *pkt;
{
register chk;
chk = chk2(pkt);
return((((chk & 0300) >> 6) + chk) & 077);
}
/* C H K 2 -- Compute the numeric sum of all the bytes in the packet. */
chk2(pkt)
register char *pkt;
{
register chk;
for (chk = 0; *pkt; ++pkt)
chk += (kparity ? (*pkt & 0177) : (*pkt & 0377));
return chk;
}
/* C H K 3 -- Compute a type-3 Kermit block check.
*
* Calculate the 16-bit CRC of a null-terminated string using a byte-oriented
* tableless algorithm invented by Andy Lowry (Columbia University). The
* magic number 010201 is derived from the CRC-CCITT polynomial x^16+x^12+x^5+1.
* Note - this function could be adapted for strings containing imbedded 0's
* by including a length argument.
*/
chk3(s)
char *s;
{
register unsigned int c, q;
LONG crc = 0;
while ((c = *s++) != '\0')
{
if (kparity)
c &= 0177;
else
c &= 0377;
q = (crc ^ c) & 017; /* Low-order nibble */
crc = (crc >> 4) ^ (q * 010201);
q = (crc ^ (c >> 4)) & 017; /* High order nibble */
crc = (crc >> 4) ^ (q * 010201);
}
return(crc);
}
Chuck Forsberg WA7KGX ...!tektronix!reed!omen!caf CIS:70715,131
Author of Professional-YAM communications Tools for PCDOS and Unix
Omen Technology Inc 17505-V NW Sauvie Island Road Portland OR 97231
Voice: 503-621-3406 TeleGodzilla: 621-3746 300/1200 L.sys entry for omen:
omen Any ACU 1200 1-503-621-3746 se:--se: link ord: Giznoid in:--in: uucp
omen!/usr/spool/uucppublic/FILES lists all uucp-able files, updated hourly
More information about the Comp.unix.wizards
mailing list