cdiff 1.1 patch #4 (minor bug & fix)

Amos Shapir amos at taux02.UUCP
Sun Jan 8 18:01:22 AEST 1989


Thanks for the fix; I just noticed that the version I sent for distribution
by Larry was not the Latest & Greatest.  Here is a fix for people who can't
stand the word 'kludge' in their code... :-)

*** cdiff.c	Sun Jan  8 08:36:47 1989
--- cdiff.c.loc	Sun Jan  8 09:54:43 1989
***************
*** 5,10
   * Usage: cdiff file1 file2
   *
   * $Log:	cdiff.c,v $
   * Revision 1.1.1.4  89/01/06  12:31:41  lwall
   * patch4: now passes diff switches through
   * patch4: handles directories better

--- 5,13 -----
   * Usage: cdiff file1 file2
   *
   * $Log:	cdiff.c,v $
+  * Local revision 2 88/10/26 11:57:36 amos at kleo1
+  * fix bug in dir code - append last component only
+  *
   * Revision 1.1.1.4  89/01/06  12:31:41  lwall
   * patch4: now passes diff switches through
   * patch4: handles directories better
***************
*** 49,54
  char *malloc();
  char *realloc();
  char *fgets();
  FILE *popen();
  
  #define Nullfp (FILE*)0

--- 52,58 -----
  char *malloc();
  char *realloc();
  char *fgets();
+ char *strrchr();
  FILE *popen();
  
  #define Nullfp (FILE*)0
***************
*** 103,109
  
      stat(old,&statbuf);
      if((statbuf.st_mode&S_IFMT) == S_IFDIR) {
! 	sprintf(buf, "%s/%s", old, new);
  	old = buf;
  	stat(old,&statbuf);
      }

--- 107,113 -----
  
      stat(old,&statbuf);
      if((statbuf.st_mode&S_IFMT) == S_IFDIR) {
! 	sprintf(buf, "%s/%s", old, (s = strrchr(new, '/')) == NULL ? new : s+1);
  	old = buf;
  	stat(old,&statbuf);
      }
***************
*** 116,122
  
      stat(new,&statbuf);
      if((statbuf.st_mode&S_IFMT) == S_IFDIR) {
! 	sprintf(buf, "%s/%s", new, old);
  	new = buf;
  	stat(new,&statbuf);
      }

--- 120,126 -----
  
      stat(new,&statbuf);
      if((statbuf.st_mode&S_IFMT) == S_IFDIR) {
! 	sprintf(buf, "%s/%s", new, (s = strrchr(old, '/')) == NULL ? old : s+1);
  	new = buf;
  	stat(new,&statbuf);
      }
-- 
	Amos Shapir				amos at nsc.com
National Semiconductor (Israel) P.O.B. 3007, Herzlia 46104, Israel
Tel. +972 52 522261  TWX: 33691, fax: +972-52-558322
34 48 E / 32 10 N			(My other cpu is a NS32532)



More information about the Comp.sources.bugs mailing list