Annotation of src/usr.bin/diff/diff.h, Revision 1.6
1.6 ! millert 1: /* $OpenBSD: diff.h,v 1.5 2003/06/25 07:26:59 tedu Exp $ */
1.2 deraadt 2:
3: /*
4: * Copyright (C) Caldera International Inc. 2001-2002.
5: * All rights reserved.
6: *
7: * Redistribution and use in source and binary forms, with or without
8: * modification, are permitted provided that the following conditions
9: * are met:
10: * 1. Redistributions of source code and documentation must retain the above
11: * copyright notice, this list of conditions and the following disclaimer.
12: * 2. Redistributions in binary form must reproduce the above copyright
13: * notice, this list of conditions and the following disclaimer in the
14: * documentation and/or other materials provided with the distribution.
15: * 3. All advertising materials mentioning features or use of this software
16: * must display the following acknowledgement:
17: * This product includes software developed or owned by Caldera
18: * International, Inc.
19: * 4. Neither the name of Caldera International, Inc. nor the names of other
20: * contributors may be used to endorse or promote products derived from
21: * this software without specific prior written permission.
22: *
23: * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
24: * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
25: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27: * IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE FOR ANY DIRECT,
28: * INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33: * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34: * POSSIBILITY OF SUCH DAMAGE.
35: */
36:
1.1 deraadt 37: /* diff.h 4.7 85/08/16 */
38:
39: /*
40: * diff - common declarations
41: */
42:
43: #include <sys/param.h>
44: #include <sys/stat.h>
45: #include <sys/dir.h>
1.6 ! millert 46:
! 47: #include <ctype.h>
! 48: #include <err.h>
1.1 deraadt 49: #include <signal.h>
1.6 ! millert 50: #include <stdio.h>
1.1 deraadt 51:
52: /*
53: * Output format options
54: */
55: int opt;
56:
57: #define D_NORMAL 0 /* Normal output */
58: #define D_EDIT -1 /* Editor script out */
59: #define D_REVERSE 1 /* Reverse editor script */
60: #define D_CONTEXT 2 /* Diff with context */
1.6 ! millert 61: #define D_UNIFIED 3 /* Unified context diff */
! 62: #define D_IFDEF 4 /* Diff with merged #ifdef's */
! 63: #define D_NREVERSE 5 /* Reverse ed script with numbered
1.1 deraadt 64: lines and no trailing . */
65:
66: int tflag; /* expand tabs on output */
67:
68: /*
69: * Algorithm related options
70: */
71: int hflag; /* -h, use halfhearted DIFFH */
72: int bflag; /* ignore blanks in comparisons */
73: int wflag; /* totally ignore blanks in comparisons */
74: int iflag; /* ignore case in comparisons */
75:
76: /*
77: * Options on hierarchical diffs.
78: */
79: int lflag; /* long output format with header */
80: int rflag; /* recursively trace directories */
81: int sflag; /* announce files which are same */
82: char *start; /* do file only if name >= this */
83:
84: /*
85: * Variables for -I D_IFDEF option.
86: */
87: int wantelses; /* -E */
88: char *ifdef1; /* String for -1 */
89: char *ifdef2; /* String for -2 */
90: char *endifname; /* What we will print on next #endif */
91: int inifdef;
92:
93: /*
94: * Variables for -c context option.
95: */
96: int context; /* lines of context to be printed */
97:
98: /*
99: * State for exit status.
100: */
101: int status;
102: int anychange;
103: char *tempfile; /* used when comparing against std input */
104:
105: /*
106: * Variables for diffdir.
107: */
108: char **diffargv; /* option list to pass to recursive diffs */
109:
110: /*
111: * Input file names.
112: * With diffdir, file1 and file2 are allocated BUFSIZ space,
113: * and padded with a '/', and then efile0 and efile1 point after
114: * the '/'.
115: */
116: char *file1, *file2, *efile1, *efile2;
117: struct stat stb1, stb2;
118:
1.3 tedu 119: void *talloc(size_t);
120: void *ralloc(void *, size_t);
121: char *splice(char *, char *);
122: char *copytemp(void);
123: void diffdir(char **);
124: void diffreg(void);
125: int max(int, int);
126: int min(int, int);
1.6 ! millert 127: __dead void done(int);
1.1 deraadt 128:
129: extern char diffh[], diff[], pr[];