Date: Sat, 26 Jul 2008 15:16:51 GMT From: Gabor Kovesdan <gabor@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 145977 for review Message-ID: <200807261516.m6QFGpo2004955@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=145977 Change 145977 by gabor@gabor_server on 2008/07/26 15:16:30 - Fix --ignore-file-name-case Affected files ... .. //depot/projects/soc2008/gabor_textproc/diff/diffdir.c#5 edit Differences ... ==== //depot/projects/soc2008/gabor_textproc/diff/diffdir.c#5 (text+ko) ==== @@ -47,7 +47,7 @@ static int dircompare(const void *, const void *); static int excluded(const char *); static struct dirent **slurpdir(char *, char **, int); -static void diffit(struct dirent *, char *, size_t, char *, size_t); +static void diffit(struct dirent *, struct dirent *, char *, size_t, char *, size_t); #define d_status d_type /* we need to store status for -l */ @@ -116,13 +116,13 @@ strcasecmp(dent1->d_name, dent2->d_name); if (pos == 0) { /* file exists in both dirs, diff it */ - diffit(dent1, path1, dirlen1, path2, dirlen2); + diffit(dent1, dent2, path1, dirlen1, path2, dirlen2); dp1++; dp2++; } else if (pos < 0) { /* file only in first dir, only diff if -N */ if (Nflag) - diffit(dent1, path1, dirlen1, path2, dirlen2); + diffit(dent1, dent2, path1, dirlen1, path2, dirlen2); else if (lflag) dent1->d_status |= D_ONLY; else @@ -131,7 +131,7 @@ } else { /* file only in second dir, only diff if -N or -P */ if (Nflag || Pflag) - diffit(dent2, path1, dirlen1, path2, dirlen2); + diffit(dent2, dent1, path1, dirlen1, path2, dirlen2); else if (lflag) dent2->d_status |= D_ONLY; else @@ -268,11 +268,11 @@ * Do the actual diff by calling either diffreg() or diffdir(). */ static void -diffit(struct dirent *dp, char *path1, size_t plen1, char *path2, size_t plen2) +diffit(struct dirent *dp1, struct dirent *dp2,char *path1, size_t plen1, char *path2, size_t plen2) { int flags = D_HEADER; - strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); + strlcpy(path1 + plen1, dp1->d_name, MAXPATHLEN - plen1); if (stat(path1, &stb1) != 0) { if (!(Nflag || Pflag) || errno != ENOENT) { warn("%s", path1); @@ -282,7 +282,7 @@ memset(&stb1, 0, sizeof(stb1)); } - strlcpy(path2 + plen2, dp->d_name, MAXPATHLEN - plen2); + strlcpy(path2 + plen2, dp2->d_name, MAXPATHLEN - plen2); if (stat(path2, &stb2) != 0) { if (!Nflag || errno != ENOENT) { warn("%s", path2); @@ -299,20 +299,20 @@ if (rflag) diffdir(path1, path2); else if (lflag) - dp->d_status |= D_COMMON; + dp1->d_status |= D_COMMON; else printf("Common subdirectories: %s and %s\n", path1, path2); return; } if (!S_ISREG(stb1.st_mode) && !S_ISDIR(stb1.st_mode)) - dp->d_status = D_SKIPPED1; + dp1->d_status = D_SKIPPED1; else if (!S_ISREG(stb2.st_mode) && !S_ISDIR(stb2.st_mode)) - dp->d_status = D_SKIPPED2; + dp1->d_status = D_SKIPPED2; else - dp->d_status = diffreg(path1, path2, flags); + dp1->d_status = diffreg(path1, path2, flags); if (!lflag) - print_status(dp->d_status, path1, path2, NULL); + print_status(dp1->d_status, path1, path2, NULL); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807261516.m6QFGpo2004955>