[comp.sources.misc] v02i061: More complete patch for pd-cdiff

neil@yc.estec.nl.UUCP (Neil Dixon) (02/29/88)

Comp.sources.misc: Volume 2, Issue 61

Submitted-By: Neil Dixon <neil@yc.estec.nl>

Archive-Name: pd-diff-pat-2


Comp.sources.misc: Volume 2, Issue 61
Submitted-By: Neil Dixon <neil@yc.estec.nl>
Archive-Name: pd-diff-pat-2

[Don't look now, but issue 63 is the next version!  ++bsa]

In article <7242@ncoast.UUCP> mike2@lcuxa.UUCP writes:
>
>Neil Dixon uncovered a flaw in the logic of the cdiff program that
>was distributed early in January, and which was redistributed with
>changes to make it compilable in Turbo C.  I've tested his patch
>both on the Unix SysVr2 version and on the PC, and have not found
>any errors.

I'm afraid my patch was both incomplete and inelegent. Here's a better patch
to the ORIGINAL program.

*** cdiff.c.orig
--- cdiff.c
**************
*** 937,944
      }
    }
    putchar('\n');
!   if (!eflag) {
!   	fetch(oldseek, astart, aend, lenA, infd[0], 
  	    cflag ? (c=='d' ? "- " : "! ") : "< ");
  	if (cflag) {
  	  fputs("--- ", stdout);
--- 937,944 -----
      }
    }
    putchar('\n');
!   if (cflag || c != 'a') {
!   	fetch(oldseek, astart , aend, lenA, infd[0], 
  	    cflag ? (c=='d' ? "- " : "! ") : "< ");
  	if (cflag) {
  	  fputs("--- ", stdout);
**************
*** 947,953
  	} else if (astart <= aend && bstart <= bend)
    	  printf("---\n");
    }
!   fetch(newseek, bstart, bend, lenB, infd[1], 
        cflag ? (c=='a' ? "+ " : "! ") : (eflag ? "" : "> "));
    if (eflag && bstart <= bend)
    	printf(".\n");
--- 947,954 -----
  	} else if (astart <= aend && bstart <= bend)
    	  printf("---\n");
    }
!   if(cflag || c != 'd') {
! 	fetch(newseek, bstart, bend, lenB, infd[1], 
        cflag ? (c=='a' ? "+ " : "! ") : (eflag ? "" : "> "));
    }
    if (eflag && bstart <= bend)
**************
*** 949,954
    }
    fetch(newseek, bstart, bend, lenB, infd[1], 
        cflag ? (c=='a' ? "+ " : "! ") : (eflag ? "" : "> "));
    if (eflag && bstart <= bend)
    	printf(".\n");
  }
--- 950,956 -----
    if(cflag || c != 'd') {
  	fetch(newseek, bstart, bend, lenB, infd[1], 
        cflag ? (c=='a' ? "+ " : "! ") : (eflag ? "" : "> "));
+   }
    if (eflag && bstart <= bend)
    	printf(".\n");
  }
-- 
Neil Dixon <neil@yc.estec.nl> UUCP:...!mcvax!esatst!neil, BITNET: NDIXON@ESTEC
Thermal Control & Life Support Division (YC) 
European Space Research and Technology Centre (ESTEC),
Noordwijk, The Netherlands.