Annotation of src/usr.bin/diff/diff.h, Revision 1.2
1.2 ! deraadt 1: /* $OpenBSD$ */
! 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 <stdio.h>
44: #include <ctype.h>
45: #include <sys/param.h>
46: #include <sys/stat.h>
47: #include <sys/dir.h>
48: #include <signal.h>
49:
50: /*
51: * Output format options
52: */
53: int opt;
54:
55: #define D_NORMAL 0 /* Normal output */
56: #define D_EDIT -1 /* Editor script out */
57: #define D_REVERSE 1 /* Reverse editor script */
58: #define D_CONTEXT 2 /* Diff with context */
59: #define D_IFDEF 3 /* Diff with merged #ifdef's */
60: #define D_NREVERSE 4 /* Reverse ed script with numbered
61: lines and no trailing . */
62:
63: int tflag; /* expand tabs on output */
64:
65: /*
66: * Algorithm related options
67: */
68: int hflag; /* -h, use halfhearted DIFFH */
69: int bflag; /* ignore blanks in comparisons */
70: int wflag; /* totally ignore blanks in comparisons */
71: int iflag; /* ignore case in comparisons */
72:
73: /*
74: * Options on hierarchical diffs.
75: */
76: int lflag; /* long output format with header */
77: int rflag; /* recursively trace directories */
78: int sflag; /* announce files which are same */
79: char *start; /* do file only if name >= this */
80:
81: /*
82: * Variables for -I D_IFDEF option.
83: */
84: int wantelses; /* -E */
85: char *ifdef1; /* String for -1 */
86: char *ifdef2; /* String for -2 */
87: char *endifname; /* What we will print on next #endif */
88: int inifdef;
89:
90: /*
91: * Variables for -c context option.
92: */
93: int context; /* lines of context to be printed */
94:
95: /*
96: * State for exit status.
97: */
98: int status;
99: int anychange;
100: char *tempfile; /* used when comparing against std input */
101:
102: /*
103: * Variables for diffdir.
104: */
105: char **diffargv; /* option list to pass to recursive diffs */
106:
107: /*
108: * Input file names.
109: * With diffdir, file1 and file2 are allocated BUFSIZ space,
110: * and padded with a '/', and then efile0 and efile1 point after
111: * the '/'.
112: */
113: char *file1, *file2, *efile1, *efile2;
114: struct stat stb1, stb2;
115:
116: char *malloc(), *talloc(), *ralloc();
117: char *savestr(), *splice(), *splicen();
118: char *mktemp(), *copytemp(), *rindex();
119: int done();
120:
121: extern char diffh[], diff[], pr[];