summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-07-04 02:54:37 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-07-04 02:54:37 +0000
commitfafe63024932031f8280fcede1b69f28e6e3060e (patch)
treeab7160f34a3172557e2c98e47cbbc53d80dc12c8
parent585fc6047b6a97edbf1cfdfe894bd1bb387abab9 (diff)
Some cosmetic fixes:
o get rid of now-unused tempfile variable o move inifdef into diffreg.c (only used there) o correct a comment o use _PATH_DIFF, _PATH_DIFFH and _PATH_PR instead of variables set to them o get rid of hack to look for pr and diff in /bin
-rw-r--r--usr.bin/diff/diff.c14
-rw-r--r--usr.bin/diff/diff.h5
-rw-r--r--usr.bin/diff/diffdir.c13
-rw-r--r--usr.bin/diff/diffreg.c7
4 files changed, 16 insertions, 23 deletions
diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c
index 4abc8821cbb..1c5998fab0c 100644
--- a/usr.bin/diff/diff.c
+++ b/usr.bin/diff/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.18 2003/06/27 17:08:45 david Exp $ */
+/* $OpenBSD: diff.c,v 1.19 2003/07/04 02:54:36 millert Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -63,31 +63,25 @@ int lflag; /* long output format with header */
int rflag; /* recursively trace directories */
int sflag; /* announce files which are same */
char *start; /* do file only if name >= this */
-/* Variables for -D D_IFDEF option. */
+/* Variable for -D D_IFDEF option. */
char *ifdefname; /* What we will print for #ifdef/#endif */
-int inifdef;
/* Variables for -c and -u context option. */
int context; /* lines of context to be printed */
/* State for exit status. */
int status;
int anychange;
-char *tempfile; /* used when comparing against std input */
/* Variables for diffdir. */
char **diffargv; /* option list to pass to recursive diffs */
/*
* Input file names.
- * With diffdir, file1 and file2 are allocated BUFSIZ space,
- * and padded with a '/', and then efile0 and efile1 point after
+ * With diffdir, file1 and file2 are allocated MAXPATHLEN space,
+ * and padded with a '/', and then efile1 and efile2 point after
* the '/'.
*/
char *file1, *file2, *efile1, *efile2;
struct stat stb1, stb2;
-const char *diff = _PATH_DIFF;
-const char *diffh = _PATH_DIFFH;
-const char *pr = _PATH_PR;
-
__dead void usage(void);
int
diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h
index 092a0f8d53d..ba259f92438 100644
--- a/usr.bin/diff/diff.h
+++ b/usr.bin/diff/diff.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.h,v 1.11 2003/06/26 22:04:45 millert Exp $ */
+/* $OpenBSD: diff.h,v 1.12 2003/07/04 02:54:36 millert Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -62,11 +62,10 @@
extern int aflag, bflag, hflag, iflag, lflag, rflag, sflag, tflag, wflag;
extern char *start, *ifdefname;
-extern int opt, wantelses, inifdef, context, status, anychange;
+extern int opt, wantelses, context, status, anychange;
extern char *tempfiles[], **diffargv;
extern char *file1, *file2, *efile1, *efile2;
extern struct stat stb1, stb2;
-extern const char *diffh, *diff, *pr;
void *emalloc(size_t);
void *erealloc(void *, size_t);
diff --git a/usr.bin/diff/diffdir.c b/usr.bin/diff/diffdir.c
index d25d4d48491..a60116444ed 100644
--- a/usr.bin/diff/diffdir.c
+++ b/usr.bin/diff/diffdir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diffdir.c,v 1.15 2003/06/27 20:28:13 tedu Exp $ */
+/* $OpenBSD: diffdir.c,v 1.16 2003/07/04 02:54:36 millert Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -46,6 +46,7 @@
#include <unistd.h>
#include "diff.h"
+#include "pathnames.h"
#if 0
static const char sccsid[] = "@(#)diffdir.c 4.12 (Berkeley) 4/30/89";
@@ -383,9 +384,8 @@ calldiff(char *wantpr)
dup(pv[0]);
close(pv[0]);
close(pv[1]);
- execv(pr + 4, prargs);
- execv(pr, prargs);
- errorx("%s", pr);
+ execv(_PATH_PR, prargs);
+ errorx("%s", _PATH_PR);
}
}
pid = fork();
@@ -398,9 +398,8 @@ calldiff(char *wantpr)
close(pv[0]);
close(pv[1]);
}
- execv(diff + 4, diffargv);
- execv(diff, diffargv);
- error("%s", diff);
+ execv(_PATH_DIFF, diffargv);
+ error("%s", _PATH_DIFF);
}
if (wantpr) {
close(pv[0]);
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
index 5bf38dfe11a..4472ae00aad 100644
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diffreg.c,v 1.24 2003/07/02 18:54:13 millert Exp $ */
+/* $OpenBSD: diffreg.c,v 1.25 2003/07/04 02:54:36 millert Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -134,6 +134,7 @@ int len[2];
struct line *sfile[2]; /* shortened by pruning common prefix and suffix */
int slen[2];
int pref, suff; /* length of prefix and suffix */
+int inifdef; /* whether or not we are in a #ifdef block */
int *class; /* will be overlaid on file[0] */
int *member; /* will be overlaid on file[1] */
int *klist; /* will be overlaid on file[0] after class */
@@ -231,8 +232,8 @@ diffreg(void)
if (hflag) {
diffargv[0] = "diffh";
- execv(diffh, diffargv);
- error("%s", diffh);
+ execv(_PATH_DIFFH, diffargv);
+ error("%s", _PATH_DIFFH);
}
chrtran = (iflag ? cup2low : clow2low);
if (strcmp(file1, "-") == 0 && strcmp(file2, "-") == 0)