summaryrefslogtreecommitdiff
path: root/usr.bin/diff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-06-26 00:20:49 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-06-26 00:20:49 +0000
commita3d3a9af4e909ee12770b6945107aeb8259b0f12 (patch)
treeca9965898388554b76d40d5f81f3defd30907929 /usr.bin/diff
parentb91bdaf0e622a961c5a12fa7671893aba657d762 (diff)
put all the flags and globals in diff.c, and declare externs in diff.h
ok millert@
Diffstat (limited to 'usr.bin/diff')
-rw-r--r--usr.bin/diff/diff.c43
-rw-r--r--usr.bin/diff/diff.h65
2 files changed, 49 insertions, 59 deletions
diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c
index e3af3a061a8..514bf394567 100644
--- a/usr.bin/diff/diff.c
+++ b/usr.bin/diff/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.11 2003/06/25 23:04:53 millert Exp $ */
+/* $OpenBSD: diff.c,v 1.12 2003/06/26 00:20:48 tedu Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -47,6 +47,42 @@ static char const sccsid[] = "@(#)diff.c 4.7 5/11/89";
/*
* diff - driver and subroutines
*/
+int opt;
+int aflag; /* treat all files as text */
+int tflag; /* expand tabs on output */
+/* Algorithm related options. */
+int hflag; /* -h, use halfhearted DIFFH */
+int bflag; /* ignore blanks in comparisons */
+int wflag; /* totally ignore blanks in comparisons */
+int iflag; /* ignore case in comparisons */
+/* Options on hierarchical diffs. */
+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 -I D_IFDEF option. */
+int wantelses; /* -E */
+char *ifdef1; /* String for -1 */
+char *ifdef2; /* String for -2 */
+char *endifname; /* What we will print on next #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
+ * the '/'.
+ */
+char *file1, *file2, *efile1, *efile2;
+struct stat stb1, stb2;
char diff[] = _PATH_DIFF;
char diffh[] = _PATH_DIFFH;
@@ -65,8 +101,11 @@ main(int argc, char **argv)
status = 2;
diffargv = argv;
- while ((ch = getopt(argc, argv, "bC:cD:efhilnrS:stU:uw")) != -1) {
+ while ((ch = getopt(argc, argv, "abC:cD:efhilnrS:stU:uw")) != -1) {
switch (ch) {
+ case 'a':
+ aflag++;
+ break;
case 'b':
bflag++;
break;
diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h
index a6985add4bc..261a8e475f4 100644
--- a/usr.bin/diff/diff.h
+++ b/usr.bin/diff/diff.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.h,v 1.7 2003/06/25 21:43:49 millert Exp $ */
+/* $OpenBSD: diff.h,v 1.8 2003/06/26 00:20:48 tedu Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -51,8 +51,6 @@
/*
* Output format options
*/
-int opt;
-
#define D_NORMAL 0 /* Normal output */
#define D_EDIT -1 /* Editor script out */
#define D_REVERSE 1 /* Reverse editor script */
@@ -62,58 +60,13 @@ int opt;
#define D_NREVERSE 5 /* Reverse ed script with numbered
lines and no trailing . */
-int tflag; /* expand tabs on output */
-
-/*
- * Algorithm related options
- */
-int hflag; /* -h, use halfhearted DIFFH */
-int bflag; /* ignore blanks in comparisons */
-int wflag; /* totally ignore blanks in comparisons */
-int iflag; /* ignore case in comparisons */
-
-/*
- * Options on hierarchical diffs.
- */
-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 -I D_IFDEF option.
- */
-int wantelses; /* -E */
-char *ifdef1; /* String for -1 */
-char *ifdef2; /* String for -2 */
-char *endifname; /* What we will print on next #endif */
-int inifdef;
-
-/*
- * Variables for -c 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
- * the '/'.
- */
-char *file1, *file2, *efile1, *efile2;
-struct stat stb1, stb2;
+extern int aflag, bflag, hflag, iflag, lflag, rflag, sflag, tflag, wflag;
+extern char *start, *ifdef1, *ifdef2, *endifname;
+extern int opt, wantelses, inifdef, context, status, anychange;
+extern char *tempfile, **diffargv;
+extern char *file1, *file2, *efile1, *efile2;
+extern struct stat stb1, stb2;
+extern char diffh[], diff[], pr[];
void *emalloc(size_t);
void *erealloc(void *, size_t);
@@ -124,5 +77,3 @@ void diffreg(void);
int max(int, int);
int min(int, int);
__dead void done(int);
-
-extern char diffh[], diff[], pr[];