[comp.os.minix] cdiff 1.1 patch #2

lwall@sdcrdcf.UUCP (Larry Wall) (06/05/87)

System: cdiff version 1.1
Patch #: 2
Priority: HIGH
Subject: won't make diffs with less than 3 lines of leading context right
From: lwall@sdcrdcf.UUCP (Larry Wall)

Description:
	If there is a difference close enough to the beginning of the file
	to require less than three lines of context, cdiff bombs out.

Repeat-By:
	How about, run cdiff on the patch level 0 cdiff vs the patch level 1
	cdiff.  Sigh.

Fix:	From rn, say "| patch -d DIR", where DIR is your cdiff source
	directory.  Outside of rn, say "cd DIR; patch <thisarticle".
	If you don't have the patch program, apply the following by hand,
	or get patch.

	If patch indicates that patchlevel is the wrong version, you may need
	to apply one or more previous patches, or the patch may already
	have been applied.  See the patchlevel.h file to find out what has or
	has not been applied.  In any event, don't continue with the patch.

	If you are missing previous patches they can be obtained from me:

	Larry Wall
	{allegra,burdvax,cbosgd,ihnp4}!sdcrdcf!lwall

	If you send a mail message of the following form it will greatly speed
	processing:

	Subject: Command
	@SH mailpatch PATH cdiff 1.1 LIST
		   ^ note the c

	where PATH is a return path FROM ME TO YOU in bang notation, and LIST
	is the number of one or more patches you need, separated by spaces,
	commas, and/or hyphens.  Saying 35- says everything from 35 to the end.

Index: patchlevel.h
Prereq: 1
1c1
< #define PATCHLEVEL 1
---
> #define PATCHLEVEL 2
 
Index: cdiff.c
Prereq: 1.1.1.1
*** cdiff.c.old	Thu Jun  4 11:22:37 1987
*** cdiff.c	Thu Jun  4 11:22:40 1987
***************
*** 1,10 ****
! static char rcsid[] = "$Header: cdiff.c,v 1.1.1.1 87/06/03 11:52:25 lwall Exp $";
  
  /* cdiff - turns a regular diff into a new-style context diff
   *
   * Usage: cdiff file1 file2
   *
   * $Log:	cdiff.c,v $
   * Revision 1.1.1.1  87/06/03  11:52:25  lwall
   * Wasn't concatenating overlapping hunks right.
   * 
--- 1,13 ----
! static char rcsid[] = "$Header: cdiff.c,v 1.1.1.2 87/06/04 11:21:43 lwall Exp $";
  
  /* cdiff - turns a regular diff into a new-style context diff
   *
   * Usage: cdiff file1 file2
   *
   * $Log:	cdiff.c,v $
+  * Revision 1.1.1.2  87/06/04  11:21:43  lwall
+  * Didn't do diffs with less than 3 lines of leading context.
+  * 
   * Revision 1.1.1.1  87/06/03  11:52:25  lwall
   * Wasn't concatenating overlapping hunks right.
   * 
***************
*** 151,158 ****
--- 154,165 ----
  
  	    oldbeg = oldmin - context;
  	    oldend = oldmax + context;
+ 	    if (oldbeg < 1)
+ 		oldbeg = 1;
  	    newbeg = newmin - context;
  	    newend = newmax + context;
+ 	    if (newbeg < 1)
+ 		newbeg = 1;
  
  	    if (preoldend < oldbeg - 1) {
  		if (preoldend >= 0) {