home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 100-199 / ff114.lzh / Vt100 / fixes / amiga.919 < prev   
Text File  |  1987-11-22  |  4KB  |  118 lines

  1. Article 9193 of comp.sys.amiga:
  2. Path: mcdsun!noao!hao!boulder!sunybcs!bingvaxu!leah!itsgw!batcomputer!cornell!rochester!udel!princeton!rutgers!husc6!cmcl2!beta!hc!ames!amdahl!drivax!davison
  3. From: davison@drivax.UUCP (Wayne Davison)
  4. Newsgroups: comp.sys.amiga
  5. Subject: Re: Late breaking fixes to VT100 R2.7
  6. Message-ID: <2590@drivax.UUCP>
  7. Date: 14 Oct 87 18:11:31 GMT
  8. References: <15638@amdahl.amdahl.com>
  9. Reply-To: davison@drivax.UUCP (Wayne Davison)
  10. Organization: Digital Research, Inc.
  11. Lines: 103
  12.  
  13. Here's a few fixes for VT100 R2.7:
  14.  
  15. Firstly, the file-chopping code for XMODEM downloads is a little over-zealous.
  16. The current code (which has been around for quite some time) will chop off ANY
  17. pattern of nulls AND Ctrl-Z's.  This is particularly bad for .arc files, since
  18. the last two characters before the padding are always a Ctrl-Z/null.  There is
  19. also a problem with the xmodem send-padding.  It always uses nulls for padding
  20. even when the last character of the file was a null.  This makes it impossible
  21. to chop the file upon receipt, because there is no distinction between padding
  22. and data.  While fixing these bugs, I noticed that the number of bytes to send
  23. was decremented inside the retry loop, which will trash your file if you don't
  24. have a perfectly clean send.  I also found that the chop algorithm will always
  25. write at least 1 byte, when sometimes it shouldn't write any.
  26.  
  27. The following context diff fixes these problems.  The chopping algorithm chops
  28. contiguous strings of nulls OR Ctrl-Zs (not a mixture), and will avoid writing
  29. anything if we chopped them all (e.g. 128-bytes worth).  The sending algorithm
  30. is optimized a bit and fixes the subtraction and padding bugs.  Enjoy!
  31. --
  32.  Wayne Davison                          ...amdahl!drivax!davison
  33. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  34.        Ziol soft ol of egrt.  Stz'l ltt oy ngx eqf rteohitk oz.
  35.            Oy ngx rg, hstqlt rkgh dt q fgzt zg stz dt afgv.
  36.  
  37.  
  38. *** xmodem.c.orig    Wed Oct  7 17:11:05 1987
  39. --- xmodem.c    Wed Oct  7 18:26:57 1987
  40. ***************
  41. *** 287,295 ****
  42.       if ((firstchar == EOT) && (errors < ERRORMAX))
  43.       {
  44.       sendchar(ACK);
  45. !     while (bufptr > 0 && (bufr[--bufptr] == 0x00 ||
  46. !                   bufr[bufptr]   == 0x1A)) ;
  47. !     write(fd, bufr, ++bufptr);
  48.       close(fd);
  49.       Do_XON();
  50.       ScrollInfoMsg(1);
  51. --- 287,300 ----
  52.       if ((firstchar == EOT) && (errors < ERRORMAX))
  53.       {
  54.       sendchar(ACK);
  55. !         /* use firstchar to remember the last char for chopping */
  56. !     if (bufptr && ((firstchar = bufr[--bufptr]) == 0 || firstchar == 0x1A))
  57. !         {
  58. !         while (bufptr && bufr[--bufptr] == firstchar)
  59. !         ;
  60. !         if (bufptr || bufr[0] != firstchar)     /* check for null buffer */
  61. !         write(fd, bufr, ++bufptr);
  62. !         }
  63.       close(fd);
  64.       Do_XON();
  65.       ScrollInfoMsg(1);
  66. ***************
  67. *** 343,362 ****
  68.           {
  69.           attempts = 0;
  70.           sprintf(scrstr2,"Sending block %4d",sectnum);
  71.           do {
  72.           InfoMsgNoScroll(scrstr2);
  73.           sendchar(SOH);
  74.           sendchar(sectnum);
  75.           sendchar(~sectnum);
  76.           checksum = 0;
  77. !         size = SECSIZ <= bytes_to_send ? SECSIZ : bytes_to_send;
  78. !         bytes_to_send -= size;
  79. !         for (j = bufptr; j < (bufptr + SECSIZ); j++)
  80. !         if (j < (bufptr + size)) {
  81. !             sendchar(bufr[j]);
  82.               checksum += bufr[j];
  83.               }
  84. !         else sendchar(0);
  85.           sendchar(checksum);
  86.           attempts++;
  87.           c = readchar();
  88. --- 348,374 ----
  89.           {
  90.           attempts = 0;
  91.           sprintf(scrstr2,"Sending block %4d",sectnum);
  92. +         size = SECSIZ <= bytes_to_send ? SECSIZ : bytes_to_send;
  93. +         bytes_to_send -= size;
  94.           do {
  95.           InfoMsgNoScroll(scrstr2);
  96.           sendchar(SOH);
  97.           sendchar(sectnum);
  98.           sendchar(~sectnum);
  99.           checksum = 0;
  100. !         for (j = bufptr; j < bufptr + size; j++)
  101. !             {
  102. !             sendchar(bufr[j]);        /* send buffer data */
  103.               checksum += bufr[j];
  104.               }
  105. !         if( size < SECSIZ )        /* check if we need to pad */
  106. !             {
  107. !             c = bufr[j-1] ? 0 : 0x1A;    /* choose correct padding */
  108. !             j = SECSIZ - size;
  109. !             checksum += j * c;
  110. !             while ( j-- )
  111. !             sendchar(c);        /* send padding */
  112. !             }
  113.           sendchar(checksum);
  114.           attempts++;
  115.           c = readchar();
  116.  
  117.  
  118.