xref: /original-bsd/usr.bin/diff/diff/diff.h (revision c3e32dec)
1 /*-
2  * Copyright (c) 1991, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  *
7  *	@(#)diff.h	8.1 (Berkeley) 06/06/93
8  */
9 
10 /*
11  * diff - common declarations
12  */
13 
14 #include <stdio.h>
15 #include <ctype.h>
16 #include <sys/param.h>
17 #include <sys/stat.h>
18 #include <sys/dir.h>
19 #include <signal.h>
20 
21 /*
22  * Output format options
23  */
24 int	opt;
25 
26 #define	D_NORMAL	0	/* Normal output */
27 #define	D_EDIT		-1	/* Editor script out */
28 #define	D_REVERSE	1	/* Reverse editor script */
29 #define	D_CONTEXT	2	/* Diff with context */
30 #define	D_IFDEF		3	/* Diff with merged #ifdef's */
31 #define	D_NREVERSE	4	/* Reverse ed script with numbered
32 				   lines and no trailing . */
33 
34 int	tflag;			/* expand tabs on output */
35 
36 /*
37  * Algorithm related options
38  */
39 int	hflag;			/* -h, use halfhearted DIFFH */
40 int	bflag;			/* ignore blanks in comparisons */
41 int	wflag;			/* totally ignore blanks in comparisons */
42 int	iflag;			/* ignore case in comparisons */
43 
44 /*
45  * Options on hierarchical diffs.
46  */
47 int	lflag;			/* long output format with header */
48 int	rflag;			/* recursively trace directories */
49 int	sflag;			/* announce files which are same */
50 char	*Start;			/* do file only if name >= this */
51 
52 /*
53  * Variables for -I D_IFDEF option.
54  */
55 int	wantelses;		/* -E */
56 char	*ifdef1;		/* String for -1 */
57 char	*ifdef2;		/* String for -2 */
58 char	*endifname;		/* What we will print on next #endif */
59 int	inifdef;
60 
61 /*
62  * Variables for -c context option.
63  */
64 int	context;		/* lines of context to be printed */
65 
66 /*
67  * State for exit status.
68  */
69 int	status;
70 int	anychange;
71 char	tempfile[];		/* used when comparing against std input */
72 
73 /*
74  * Variables for diffdir.
75  */
76 char	**diffargv;		/* option list to pass to recursive diffs */
77 
78 /*
79  * Input file names.
80  * With diffdir, file1 and file2 are allocated BUFSIZ space,
81  * and padded with a '/', and then efile0 and efile1 point after
82  * the '/'.
83  */
84 char	*file1, *file2, *efile1, *efile2;
85 struct	stat stb1, stb2;
86 
87 char	*malloc(), *talloc(), *ralloc();
88 char	*savestr(), *splice(), *splicen();
89 char	*mktemp(), *copytemp(), *rindex();
90 void	done();
91 
92 extern	char diffh[], diff[], pr[];
93