xref: /openbsd-src/usr.bin/diff/diff.h (revision 90f56ad89a9a2865b738e2fb968a31f24e4f9aa7)
1 /*	$OpenBSD: diff.h,v 1.11 2003/06/26 22:04:45 millert Exp $	*/
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 
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 
46 #include <ctype.h>
47 #include <err.h>
48 #include <signal.h>
49 #include <stdio.h>
50 
51 /*
52  * Output format options
53  */
54 #define	D_NORMAL	0	/* Normal output */
55 #define	D_EDIT		-1	/* Editor script out */
56 #define	D_REVERSE	1	/* Reverse editor script */
57 #define	D_CONTEXT	2	/* Diff with context */
58 #define	D_UNIFIED	3	/* Unified context diff */
59 #define	D_IFDEF		4	/* Diff with merged #ifdef's */
60 #define	D_NREVERSE	5	/* Reverse ed script with numbered
61 				   lines and no trailing . */
62 
63 extern int	aflag, bflag, hflag, iflag, lflag, rflag, sflag, tflag, wflag;
64 extern char	*start, *ifdefname;
65 extern int	opt, wantelses, inifdef, context, status, anychange;
66 extern char	*tempfiles[], **diffargv;
67 extern char	*file1, *file2, *efile1, *efile2;
68 extern struct	stat stb1, stb2;
69 extern const char *diffh, *diff, *pr;
70 
71 void	*emalloc(size_t);
72 void	*erealloc(void *, size_t);
73 char	*splice(char *, char *);
74 char	*copytemp(const char *, int);
75 void	diffdir(char **);
76 void	diffreg(void);
77 int	max(int, int);
78 int	min(int, int);
79 __dead void error(const char *, ...);
80 __dead void errorx(const char *, ...);
81 __dead void done(int);
82