home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d142 / diff.lha / Diff / Bugs < prev    next >
Internet Message Format  |  1988-05-22  |  2KB

  1. From: jw@sics.se (Johan Widen)
  2. Subject: patch 1 for diff.c
  3. Date: 13 Mar 88 11:41:50 GMT
  4. Organization: Swedish Institute of Computer Science, Kista
  5.  
  6.  
  7. Here are some (relatively minor) fixes for the diff program that was recently
  8. posted in comp.sources.amiga.
  9.  
  10. They fix:
  11.         strange behaviour if you do not invoke diff with
  12.  
  13.                 diff -c
  14.  
  15.         I consider this to be a minor bug as a non context diff is next to
  16.         useless.
  17.  
  18.         More imortant: if you do a diff between an empty file and a non
  19.         empty file, then the old version will output the diff but it will
  20.         also output an error message, saying that it can't find the first line
  21.         in the empty file.
  22.  
  23.  
  24. *** diff.c.old  Sun Mar 13 10:26:07 1988
  25. --- diff.c      Sat Mar  5 12:43:54 1988
  26. ***************
  27. *** 1169,1180 ****
  28.             range(bstart, bend, 1);     /* Print both, if different */
  29.     }
  30.     putchar('\n');
  31. !   if (!eflag) {
  32.         fetch(oldseek, astart, aend, 0, 0, lenA, infd[0], "< ");
  33.         if (astart <= aend && bstart <= bend)
  34.           printf("---\n");
  35.     }
  36. !   fetch(newseek, bstart, bend, 0, 0, lenB, infd[1], eflag ? "" : "> ");
  37.     if (eflag && bstart <= bend)
  38.         printf(".\n");
  39.   }
  40. --- 1169,1181 ----
  41.             range(bstart, bend, 1);     /* Print both, if different */
  42.     }
  43.     putchar('\n');
  44. !   if (c != 'a') {
  45.         fetch(oldseek, astart, aend, 0, 0, lenA, infd[0], "< ");
  46.         if (astart <= aend && bstart <= bend)
  47.           printf("---\n");
  48.     }
  49. !   if(c != 'd')
  50. !       fetch(newseek, bstart, bend, 0, 0, lenB, infd[1], eflag ? "" : "> ");
  51.     if (eflag && bstart <= bend)
  52.         printf(".\n");
  53.   }
  54. ***************
  55. *** 1257,1262 ****
  56. --- 1258,1265 ----
  57.         first = start;
  58.         last = end;
  59.     }
  60. +   if (first > last)
  61. +       return;
  62.     if (fseek(fd, seekvec[first], 0) != 0) {
  63.         printf("?Can't read line %d at %08lx (hex) in file%c\n",
  64.           start, seekvec[first],
  65.  
  66. --
  67. Johan Widen
  68. SICS, PO Box 1263, S-164 28 KISTA, SWEDEN
  69. Tel: +46 8 752 15 32    Ttx: 812 61 54 SICS S   Fax: +46 8 751 72 30
  70. Internet: jw@sics.se or {mcvax,munnari,ukc,unido}!enea!sics.se!jw
  71.  
  72.  
  73. [ Added the above fixes to diff.c  -  KED  03/24.88          ]
  74. [ Compiled using Lattice v4.01 by just saying "lc -L diff".  ]
  75. [ Get a fair number of compiler warnings about function type ]
  76. [ mismatches (probably voids) ...                            ]
  77.  
  78.