home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / ek / src / ek17.diff < prev    next >
Text File  |  2020-01-01  |  8KB  |  233 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. *** ../../ek16/kermit.h    2011-03-30 13:13:04.814335000 -0400
  141. --- kermit.h    2011-06-06 15:36:54.700435000 -0400
  142. ***************
  143. *** 1,7 ****
  144.   #ifndef __KERMIT_H__
  145.   #define __KERMIT_H__
  146.   
  147. ! #define VERSION "1.6"            /* Kermit module version number */
  148.   
  149.   /*
  150.     kermit.h -- Symbol and struct definitions for embedded Kermit.
  151. --- 1,7 ----
  152.   #ifndef __KERMIT_H__
  153.   #define __KERMIT_H__
  154.   
  155. ! #define VERSION "1.7"            /* Kermit module version number */
  156.   
  157.   /*
  158.     kermit.h -- Symbol and struct definitions for embedded Kermit.
  159. ***************
  160. *** 388,393 ****
  161. --- 388,394 ----
  162.       int zincnt;                /* Input buffer position */
  163.       int zinlen;                /* Length of input file buffer */
  164.       UCHAR * zinptr;            /* Pointer to input file buffer */
  165. +     int bctf;                /* Flag to force type 3 block check */
  166.       int dummy;
  167.   };
  168.   
  169. *** ../../ek16/main.c    2011-03-30 12:40:53.830806000 -0400
  170. --- main.c    2011-06-06 15:33:45.997789000 -0400
  171. ***************
  172. *** 124,130 ****
  173.   #endif /* RECVONLY */
  174.       fprintf(stderr," -p [neoms]   Parity: none, even, odd, mark, space\n");
  175.   #ifdef F_CRC
  176. !     fprintf(stderr," -b [123]     Block check type: 1, 2, or 3\n");
  177.   #endif /* F_CRC */
  178.       fprintf(stderr," -k           Keep incompletely received files\n");
  179.       fprintf(stderr," -B           Force binary mode\n");
  180. --- 124,130 ----
  181.   #endif /* RECVONLY */
  182.       fprintf(stderr," -p [neoms]   Parity: none, even, odd, mark, space\n");
  183.   #ifdef F_CRC
  184. !     fprintf(stderr," -b [1235]    Block check type: 1, 2, 3, or 5\n");
  185.   #endif /* F_CRC */
  186.       fprintf(stderr," -k           Keep incompletely received files\n");
  187.       fprintf(stderr," -B           Force binary mode\n");
  188. ***************
  189. *** 219,225 ****
  190.           }
  191.           if (c == 'b') {
  192.           check = atoi(*xargv);
  193. !         if (check < 1 || check > 3)
  194.             fatal("Invalid block check",(char *)0,(char *)0);
  195.   #ifdef DEBUG
  196.           } else if (c == 'E') {
  197. --- 219,225 ----
  198.           }
  199.           if (c == 'b') {
  200.           check = atoi(*xargv);
  201. !         if (check < 1 || check > 5 || check == 4)
  202.             fatal("Invalid block check",(char *)0,(char *)0);
  203.   #ifdef DEBUG
  204.           } else if (c == 'E') {
  205. ***************
  206. *** 338,344 ****
  207.       k.remote = remote;            /* Remote vs local */
  208.       k.binary = ftype;            /* 0 = text, 1 = binary */
  209.       k.parity = parity;                  /* Communications parity */
  210. !     k.bct = check;            /* Block check type */
  211.       k.ikeep = keep;            /* Keep incompletely received files */
  212.       k.filelist = cmlist;        /* List of files to send (if any) */
  213.       k.cancel = 0;            /* Not canceled yet */
  214. --- 338,344 ----
  215.       k.remote = remote;            /* Remote vs local */
  216.       k.binary = ftype;            /* 0 = text, 1 = binary */
  217.       k.parity = parity;                  /* Communications parity */
  218. !     k.bct = (check == 5) ? 3 : check;    /* Block check type */
  219.       k.ikeep = keep;            /* Keep incompletely received files */
  220.       k.filelist = cmlist;        /* List of files to send (if any) */
  221.       k.cancel = 0;            /* Not canceled yet */
  222. ***************
  223. *** 367,372 ****
  224. --- 367,374 ----
  225.   #else
  226.       k.dbf    = 0;
  227.   #endif /* DEBUG */
  228. +     /* Force Type 3 Block Check (16-bit CRC) on all packets, or not */
  229. +     k.bctf   = (check == 5) ? 1 : 0;
  230.   
  231.   /* Initialize Kermit protocol */
  232.   
  233.