summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/diff.c
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-07-14 03:59:37 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-07-14 03:59:37 +0000
commit4058f2d96b457ca49db5ab864cd074fd45b300c9 (patch)
treed10544abb89a0adb7216ef7bda27656cbceb5a01 /usr.bin/cvs/diff.c
parent300134a961a6ad41adacb49f32cc1fb6b90368ad (diff)
print diffargs correctly instead of a (null). This should make the diff
output exactly the same as the one from GNU CVS
Diffstat (limited to 'usr.bin/cvs/diff.c')
-rw-r--r--usr.bin/cvs/diff.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index 61291c7031e..68d35cc97e3 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.1 2004/07/13 22:02:40 jfb Exp $ */
+/* $OpenBSD: diff.c,v 1.2 2004/07/14 03:59:36 jfb Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
@@ -247,7 +247,8 @@ static int aflag, bflag, dflag, iflag, tflag, Tflag, wflag;
static int context, status;
static int format = D_NORMAL;
static struct stat stb1, stb2;
-static char *ifdefname, *diffargs, *ignore_pats, *diff_file;
+static char *ifdefname, *ignore_pats, diffargs[128];
+static const char *diff_file;
regex_t ignore_re;
static int *J; /* will be overlaid on class */
@@ -354,6 +355,7 @@ cvs_diff(int argc, char **argv)
char dir[MAXPATHLEN], file[MAXPATHLEN], *d1, *d2, *r1, *r2;
context = CVS_DIFF_DEFCTX;
+ strlcpy(diffargs, argv[0], sizeof(diffargs));
d1 = d2 = NULL;
r1 = r2 = NULL;
@@ -362,6 +364,7 @@ cvs_diff(int argc, char **argv)
while ((ch = getopt(argc, argv, "cD:lir:u")) != -1) {
switch (ch) {
case 'c':
+ strlcat(diffargs, " -c", sizeof(diffargs));
format = D_CONTEXT;
break;
case 'D':
@@ -376,9 +379,11 @@ cvs_diff(int argc, char **argv)
}
break;
case 'l':
+ strlcat(diffargs, " -l", sizeof(diffargs));
recurse = 0;
break;
case 'i':
+ strlcat(diffargs, " -i", sizeof(diffargs));
iflag = 1;
break;
case 'r':
@@ -394,6 +399,7 @@ cvs_diff(int argc, char **argv)
}
break;
case 'u':
+ strlcat(diffargs, " -u", sizeof(diffargs));
format = D_UNIFIED;
break;
default:
@@ -577,7 +583,11 @@ cvs_diff_file(const char *path, const char *rev1, const char *rev2)
b2 = cvs_buf_load(path, BUF_AUTOEXT);
}
- printf("%s\n", diffargs);
+ printf("%s", diffargs);
+ printf(" -r%s", buf);
+ if (rev2 != NULL)
+ printf(" -r%s", rev2);
+ printf(" %s\n", path);
cvs_buf_write(b1, "/tmp/diff1", 0600);
cvs_buf_write(b2, "/tmp/diff2", 0600);
cvs_diffreg("/tmp/diff1", "/tmp/diff2");