diff options
author | 2009-06-06 15:37:28 +0000 | |
---|---|---|
committer | 2009-06-06 15:37:28 +0000 | |
commit | 3f8e756bb946f2b52ef7332b5732ffdc77c162bd (patch) | |
tree | 4d0b88c4a4d006048d12767b52e0d100136d3be9 | |
parent | Pull changes from rcsdiff, similar to what was pulled into cvsdiff. (diff) | |
download | wireguard-openbsd-3f8e756bb946f2b52ef7332b5732ffdc77c162bd.tar.xz wireguard-openbsd-3f8e756bb946f2b52ef7332b5732ffdc77c162bd.zip |
Oops, forgot to pass dflags to diffreg. Now the flags work again.
OK millert
-rw-r--r-- | usr.bin/diff/diff.c | 8 | ||||
-rw-r--r-- | usr.bin/diff/diff.h | 4 | ||||
-rw-r--r-- | usr.bin/diff/diffdir.c | 24 |
3 files changed, 19 insertions, 17 deletions
diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index d5dde3b9bae..373fe43518a 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.51 2009/06/06 15:00:27 ray Exp $ */ +/* $OpenBSD: diff.c,v 1.52 2009/06/06 15:37:28 ray Exp $ */ /* * Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com> @@ -21,7 +21,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: diff.c,v 1.51 2009/06/06 15:00:27 ray Exp $"; +static const char rcsid[] = "$OpenBSD: diff.c,v 1.52 2009/06/06 15:37:28 ray Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -256,7 +256,7 @@ main(int argc, char **argv) if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) errx(2, "-D option not supported with directories"); - diffdir(argv[0], argv[1]); + diffdir(argv[0], argv[1], dflags); } else { if (S_ISDIR(stb1.st_mode)) { argv[0] = splice(argv[0], argv[1]); @@ -268,7 +268,7 @@ main(int argc, char **argv) if (stat(argv[1], &stb2) < 0) err(2, "%s", argv[1]); } - print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], + print_status(diffreg(argv[0], argv[1], dflags), argv[0], argv[1], NULL); } exit(status); diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h index 63002db1c40..b66853302ce 100644 --- a/usr.bin/diff/diff.h +++ b/usr.bin/diff/diff.h @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.h,v 1.30 2009/06/06 15:00:27 ray Exp $ */ +/* $OpenBSD: diff.h,v 1.31 2009/06/06 15:37:28 ray Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -96,6 +96,6 @@ int diffreg(char *, char *, int); int easprintf(char **, const char *, ...); void *emalloc(size_t); void *erealloc(void *, size_t); -void diffdir(char *, char *); +void diffdir(char *, char *, int); void print_only(const char *, size_t, const char *); void print_status(int, char *, char *, char *); diff --git a/usr.bin/diff/diffdir.c b/usr.bin/diff/diffdir.c index 2bf2130ab6c..64c187c2a61 100644 --- a/usr.bin/diff/diffdir.c +++ b/usr.bin/diff/diffdir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diffdir.c,v 1.32 2007/06/09 05:16:21 ray Exp $ */ +/* $OpenBSD: diffdir.c,v 1.33 2009/06/06 15:37:28 ray Exp $ */ /* * Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com> @@ -21,7 +21,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: diffdir.c,v 1.32 2007/06/09 05:16:21 ray Exp $"; +static const char rcsid[] = "$OpenBSD: diffdir.c,v 1.33 2009/06/06 15:37:28 ray Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -44,7 +44,7 @@ static const char rcsid[] = "$OpenBSD: diffdir.c,v 1.32 2007/06/09 05:16:21 ray 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 *, char *, size_t, char *, size_t, int); #define d_status d_type /* we need to store status for -l */ @@ -52,7 +52,7 @@ static void diffit(struct dirent *, char *, size_t, char *, size_t); * Diff directory traversal. Will be called recursively if -r was specified. */ void -diffdir(char *p1, char *p2) +diffdir(char *p1, char *p2, int flags) { struct dirent **dirp1, **dirp2, **dp1, **dp2; struct dirent *dent1, *dent2; @@ -109,13 +109,14 @@ diffdir(char *p1, char *p2) strcmp(dent1->d_name, dent2->d_name); if (pos == 0) { /* file exists in both dirs, diff it */ - diffit(dent1, path1, dirlen1, path2, dirlen2); + diffit(dent1, path1, dirlen1, path2, dirlen2, flags); 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, path1, dirlen1, path2, dirlen2, + flags); else if (lflag) dent1->d_status |= D_ONLY; else @@ -124,7 +125,8 @@ diffdir(char *p1, char *p2) } else { /* file only in second dir, only diff if -N or -P */ if (Nflag || Pflag) - diffit(dent2, path1, dirlen1, path2, dirlen2); + diffit(dent2, path1, dirlen1, path2, dirlen2, + flags); else if (lflag) dent2->d_status |= D_ONLY; else @@ -261,10 +263,10 @@ dircompare(const void *vp1, const void *vp2) * 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 *dp, char *path1, size_t plen1, char *path2, size_t plen2, + int flags) { - int flags = D_HEADER; - + flags |= D_HEADER; strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); if (stat(path1, &stb1) != 0) { if (!(Nflag || Pflag) || errno != ENOENT) { @@ -290,7 +292,7 @@ diffit(struct dirent *dp, char *path1, size_t plen1, char *path2, size_t plen2) if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (rflag) - diffdir(path1, path2); + diffdir(path1, path2, flags); else if (lflag) dp->d_status |= D_COMMON; else |