home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ek17.zip / kermit.c.diff < prev    next >
Text File  |  2011-06-06  |  5KB  |  140 lines

  1. *** ../../ek16/kermit.c    2011-03-30 12:40:09.705176000 -0400
  2. --- kermit.c    2011-06-06 16:24:13.034202000 -0400
  3. ***************
  4. *** 1,8 ****
  5.   #define KERMIT_C
  6.   /*
  7.     Embedded Kermit protocol module
  8. !   Version: 1.6
  9. !   Most Recent Update: Wed Mar 30 12:39:11 2011
  10.   
  11.     No stdio or other runtime library calls, no system calls, no system 
  12.     includes, no static data, and no global variables in this module.
  13. --- 1,8 ----
  14.   #define KERMIT_C
  15.   /*
  16.     Embedded Kermit protocol module
  17. !   Version: 1.7
  18. !   Most Recent Update: Mon Jun  6 15:36:26 2011
  19.   
  20.     No stdio or other runtime library calls, no system calls, no system 
  21.     includes, no static data, and no global variables in this module.
  22. ***************
  23. *** 98,104 ****
  24.   
  25.       int i, j, rc;            /* Workers */
  26.       int datalen;                        /* Length of packet data field */
  27. -     int bctu;                /* Block check type for this packet */
  28.       UCHAR *p;                           /* Pointer to packet data field */
  29.       UCHAR *q;                           /* Pointer to data to be checked */
  30.       UCHAR *s;                /* Worker string pointer */
  31. --- 98,103 ----
  32. ***************
  33. *** 313,319 ****
  34.           }
  35.       debug(DB_MSG,"HDR CHKSUM OK",0,0);
  36.           p[2] = c;                       /* Put checksum back */
  37. !         datalen = xunchar(p[0])*95 + xunchar(p[1]) - k->bct; /* Data length */
  38.           p += 3;                         /* Fix data pointer */
  39.           k->ipktinfo[r_slot].dat = p;    /* Permanent record of data pointer */
  40.       } else {                            /* Regular packet */
  41. --- 312,319 ----
  42.           }
  43.       debug(DB_MSG,"HDR CHKSUM OK",0,0);
  44.           p[2] = c;                       /* Put checksum back */
  45. !     /* Data length */
  46. !         datalen = xunchar(p[0])*95 + xunchar(p[1]) - ((k->bctf) ? 3 : k->bct);
  47.           p += 3;                         /* Fix data pointer */
  48.           k->ipktinfo[r_slot].dat = p;    /* Permanent record of data pointer */
  49.       } else {                            /* Regular packet */
  50. ***************
  51. *** 323,334 ****
  52. --- 323,342 ----
  53.       }
  54.   #endif /* F_LP */
  55.   #ifdef F_CRC
  56. +     if (k->bctf) {            /* FORCE 3 */
  57. +     chklen = 3;
  58. +     } else {
  59.       if (t == 'S' || k->state == S_INIT) { /* S-packet was retransmitted? */
  60. +         if (q[10] == '5') {        /* Block check type requested is 5 */
  61. +         k->bctf = 1;        /* FORCE 3 */
  62. +         chklen = 3;
  63. +         }
  64.           chklen = 1;            /* Block check is always type 1 */
  65.           datalen = k->ipktinfo[r_slot].len - 3; /* Data length */
  66.       } else {
  67.           chklen = k->bct;
  68.       }
  69. +     }
  70.   #else
  71.       chklen = 1;                /* Block check is always type 1 */
  72.       datalen = k->ipktinfo[r_slot].len - 3; /* Data length */
  73. ***************
  74. *** 1031,1036 ****
  75. --- 1039,1045 ----
  76.           if ((k->bct < 1) || (k->bct > 3))
  77.   #endif /* F_CRC */
  78.         k->bct = 1;
  79. +     if (k->bctf) k->bct = 3;
  80.       }
  81.       if (datalen >= 9) {                 /* Repeat counts */
  82.           if ((s[9] > 32 && s[9] < 63) || (s[9] > 95 && s[9] < 127)) {
  83. ***************
  84. *** 1120,1126 ****
  85.         d[ 6] = k->ebq = '&';           /* I need to request it */
  86.       else                                /* else just agree with other Kermit */
  87.         d[ 6] = k->ebq;
  88. !     d[ 7] = k->bct + '0';               /* Block check type */
  89.       d[ 8] = k->rptq;            /* Repeat prefix */
  90.       d[ 9] = tochar(k->capas);           /* Capability bits */
  91.       d[10] = tochar(k->window);          /* Window size */
  92. --- 1129,1138 ----
  93.         d[ 6] = k->ebq = '&';           /* I need to request it */
  94.       else                                /* else just agree with other Kermit */
  95.         d[ 6] = k->ebq;
  96. !     if (k->bctf)            /* Block check type */
  97. !       d[7] = '5';            /* FORCE 3 */
  98. !     else
  99. !       d[7] = k->bct + '0';        /* Normal */
  100.       d[ 8] = k->rptq;            /* Repeat prefix */
  101.       d[ 9] = tochar(k->capas);           /* Capability bits */
  102.       d[10] = tochar(k->window);          /* Window size */
  103. ***************
  104. *** 1136,1143 ****
  105. --- 1148,1157 ----
  106.   #endif /* F_LP */
  107.   
  108.   #ifdef F_CRC
  109. +     if (!(k->bctf)) {            /* Unless FORCE 3 */
  110.       b = k->bct;
  111.       k->bct = 1;            /* Always use block check type 1 */
  112. +     }
  113.   #endif /* F_CRC */
  114.       switch (type) {
  115.         case 'Y':                /* This is an ACK for packet 0 */
  116. ***************
  117. *** 1150,1156 ****
  118. --- 1164,1172 ----
  119.       rc = -1;
  120.       }
  121.   #ifdef F_CRC
  122. +     if (!(k->bctf)) {            /* Unless FORCE 3 */
  123.       k->bct = b;
  124. +     }
  125.   #endif /* F_CRC */
  126.       return(rc);                         /* Pass along return code. */
  127.   }
  128. ***************
  129. *** 1510,1516 ****
  130. --- 1526,1534 ----
  131.   
  132.   STATIC void
  133.   epkt(char * msg, struct k_data * k) {
  134. +     if (!(k->bctf)) {            /* Unless FORCE 3 */
  135.       k->bct = 1;
  136. +     }
  137.       (void) spkt('E', 0, -1, (UCHAR *) msg, k);
  138.   }
  139.   
  140.