Path: utzoo!attcan!uunet!lll-winken!ames!pasteur!ucbvax!decwrl!nsc!taux01!taux02!amos From: amos@taux02.UUCP (Amos Shapir) Newsgroups: comp.sources.bugs Subject: Re: cdiff 1.1 patch #4 (minor bug & fix) Message-ID: <400@taux02.UUCP> Date: 8 Jan 89 08:01:22 GMT References: <3843@jpl-devvax.JPL.NASA.GOV> <177@wzv.UUCP> Organization: National Semiconductor (IC) Ltd, Israel Home of the 32532 Lines: 83 Hdate: 2 Shvat 5749 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@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@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)