MFp4: Increase character timeout to 10. Make it a #define for easier

changes in the future.  This helps with getting started and to
overcome the really sucky level of granuality this timeout has in
getc.  A timeout of 1 means 'wait until top of next second' rather
than 'wait for at least a second'.
This commit is contained in:
Warner Losh 2006-08-10 17:54:51 +00:00
parent 9fd9c34a3f
commit b51b3172ba

View File

@ -39,6 +39,7 @@
#define CAN 0x18 /* Cancel */
#define EOT 0x04 /* end of text */
#define TO 10
/*
* int GetRecord(char , char *)
* This private function receives a x-modem record to the pointer and
@ -53,17 +54,17 @@ GetRecord(char blocknum, char *dest)
chk = 0;
if ((ch = getc(1)) == -1)
if ((ch = getc(TO)) == -1)
goto err;
if (ch != blocknum)
if (ch != blocknum)
goto err;
if ((ch = getc(1)) == -1)
if ((ch = getc(TO)) == -1)
goto err;
if (ch != (~blocknum & 0xff))
goto err;
for (size = 0; size < PACKET_SIZE; ++size) {
if ((ch = getc(1)) == -1)
if ((ch = getc(TO)) == -1)
goto err;
chk = chk ^ ch << 8;
for (j = 0; j < 8; ++j) {
@ -77,10 +78,10 @@ GetRecord(char blocknum, char *dest)
chk &= 0xFFFF;
if (((ch = getc(1)) == -1) || ((ch & 0xff) != ((chk >> 8) & 0xFF)))
goto err;
if (((ch = getc(1)) == -1) || ((ch & 0xff) != (chk & 0xFF)))
goto err;
if (((ch = getc(TO)) == -1) || ((ch & 0xff) != ((chk >> 8) & 0xFF)))
goto err;
if (((ch = getc(TO)) == -1) || ((ch & 0xff) != (chk & 0xFF)))
goto err;
putchar(ACK);
return (1);