xref: /openbsd-src/usr.bin/cvs/diff.h (revision ce7279d89b71439c96c854f612f4ac93a461fdc4)
1*ce7279d8Sjsg /*	$OpenBSD: diff.h,v 1.23 2024/05/21 05:00:48 jsg Exp $	*/
2af5bb824Sniallo /*
3af5bb824Sniallo  * Copyright (C) Caldera International Inc.  2001-2002.
4af5bb824Sniallo  * All rights reserved.
5af5bb824Sniallo  *
6af5bb824Sniallo  * Redistribution and use in source and binary forms, with or without
7af5bb824Sniallo  * modification, are permitted provided that the following conditions
8af5bb824Sniallo  * are met:
9af5bb824Sniallo  * 1. Redistributions of source code and documentation must retain the above
10af5bb824Sniallo  *    copyright notice, this list of conditions and the following disclaimer.
11af5bb824Sniallo  * 2. Redistributions in binary form must reproduce the above copyright
12af5bb824Sniallo  *    notice, this list of conditions and the following disclaimer in the
13af5bb824Sniallo  *    documentation and/or other materials provided with the distribution.
14af5bb824Sniallo  * 3. All advertising materials mentioning features or use of this software
15af5bb824Sniallo  *    must display the following acknowledgement:
16af5bb824Sniallo  *	This product includes software developed or owned by Caldera
17af5bb824Sniallo  *	International, Inc.
18af5bb824Sniallo  * 4. Neither the name of Caldera International, Inc. nor the names of other
19af5bb824Sniallo  *    contributors may be used to endorse or promote products derived from
20af5bb824Sniallo  *    this software without specific prior written permission.
21af5bb824Sniallo  *
22af5bb824Sniallo  * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
23af5bb824Sniallo  * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
24af5bb824Sniallo  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25af5bb824Sniallo  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26af5bb824Sniallo  * IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE FOR ANY DIRECT,
27af5bb824Sniallo  * INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28af5bb824Sniallo  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29af5bb824Sniallo  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30af5bb824Sniallo  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31af5bb824Sniallo  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32af5bb824Sniallo  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33af5bb824Sniallo  * POSSIBILITY OF SUCH DAMAGE.
34af5bb824Sniallo  */
35af5bb824Sniallo /*-
36af5bb824Sniallo  * Copyright (c) 1991, 1993
37af5bb824Sniallo  *	The Regents of the University of California.  All rights reserved.
38af5bb824Sniallo  * Copyright (c) 2004 Jean-Francois Brousseau.  All rights reserved.
39af5bb824Sniallo  *
40af5bb824Sniallo  * Redistribution and use in source and binary forms, with or without
41af5bb824Sniallo  * modification, are permitted provided that the following conditions
42af5bb824Sniallo  * are met:
43af5bb824Sniallo  * 1. Redistributions of source code must retain the above copyright
44af5bb824Sniallo  *    notice, this list of conditions and the following disclaimer.
45af5bb824Sniallo  * 2. Redistributions in binary form must reproduce the above copyright
46af5bb824Sniallo  *    notice, this list of conditions and the following disclaimer in the
47af5bb824Sniallo  *    documentation and/or other materials provided with the distribution.
48af5bb824Sniallo  * 3. Neither the name of the University nor the names of its contributors
49af5bb824Sniallo  *    may be used to endorse or promote products derived from this software
50af5bb824Sniallo  *    without specific prior written permission.
51af5bb824Sniallo  *
52af5bb824Sniallo  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53af5bb824Sniallo  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54af5bb824Sniallo  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55af5bb824Sniallo  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56af5bb824Sniallo  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57af5bb824Sniallo  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58af5bb824Sniallo  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59af5bb824Sniallo  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60af5bb824Sniallo  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61af5bb824Sniallo  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62af5bb824Sniallo  * SUCH DAMAGE.
63af5bb824Sniallo  *
64af5bb824Sniallo  *	@(#)diffreg.c   8.1 (Berkeley) 6/6/93
65af5bb824Sniallo  */
667bb3ddb0Sray #ifndef DIFF_H
677bb3ddb0Sray #define DIFF_H
68af5bb824Sniallo #define CVS_DIFF_DEFCTX	3	/* default context length */
69af5bb824Sniallo 
70af5bb824Sniallo /*
71af5bb824Sniallo  * Output format options
72af5bb824Sniallo  */
73af5bb824Sniallo #define	D_NORMAL	0	/* Normal output */
74af5bb824Sniallo #define	D_CONTEXT	1	/* Diff with context */
75af5bb824Sniallo #define	D_UNIFIED	2	/* Unified context diff */
76af5bb824Sniallo #define	D_IFDEF		3	/* Diff with merged #ifdef's */
77af5bb824Sniallo #define	D_BRIEF		4	/* Say if the files differ */
78af5bb824Sniallo #define	D_RCSDIFF	5       /* Reverse editor output: RCS format */
79af5bb824Sniallo 
80af5bb824Sniallo /*
81219c50abSray  * Command line flags
82219c50abSray  */
83219c50abSray #define	D_FORCEASCII	0x01	/* Treat file as ascii regardless of content */
84219c50abSray #define	D_FOLDBLANKS	0x02	/* Treat all white space as equal */
85219c50abSray #define	D_MINIMAL	0x04	/* Make diff as small as possible */
86219c50abSray #define	D_IGNORECASE	0x08	/* Case-insensitive matching */
87219c50abSray #define	D_PROTOTYPE	0x10	/* Display C function prototype */
88219c50abSray #define	D_EXPANDTABS	0x20	/* Expand tabs to spaces */
89219c50abSray #define	D_IGNOREBLANKS	0x40	/* Ignore white space changes */
90219c50abSray 
91219c50abSray /*
9257003866Sray  * Status values for diffreg() return values
93af5bb824Sniallo  */
94af5bb824Sniallo #define	D_SAME		0	/* Files are the same */
95af5bb824Sniallo #define	D_DIFFER	1	/* Files are different */
96af5bb824Sniallo #define	D_BINARY	2	/* Binary files are different */
97af5bb824Sniallo #define	D_COMMON	3	/* Subdirectory common to both dirs */
98af5bb824Sniallo #define	D_ONLY		4	/* Only exists in one directory */
99af5bb824Sniallo #define	D_MISMATCH1	5	/* path1 was a dir, path2 a file */
100af5bb824Sniallo #define	D_MISMATCH2	6	/* path1 was a file, path2 a dir */
101af5bb824Sniallo #define	D_ERROR		7	/* An error occurred */
102af5bb824Sniallo #define	D_SKIPPED1	8	/* path1 was a special file */
103af5bb824Sniallo #define	D_SKIPPED2	9	/* path2 was a special file */
104af5bb824Sniallo 
105828954c0Sjoris void		cvs_merge_file(struct cvs_file *, int);
10601af718aSjoris void		diff_output(const char *, ...);
10757003866Sray int		diffreg(const char *, const char *, int, int, BUF *, int);
1087bb3ddb0Sray int		ed_patch_lines(struct rcs_lines *, struct rcs_lines *);
10901af718aSjoris 
110f9b67873Sniallo extern int       diff_format;
11172026f1aSnicm extern int	 diff_context;
11241714577Sxsa extern int	 diff3_conflicts;
1137bb3ddb0Sray extern char	 diffargs[512]; /* XXX */
11401af718aSjoris extern BUF	*diffbuf;
1156d7e6850Sjoris extern RCSNUM	*diff_rev1;
1166d7e6850Sjoris extern RCSNUM	*diff_rev2;
11725d391d7Sjoris extern RCSNUM	*d3rev1;
11825d391d7Sjoris extern RCSNUM	*d3rev2;
11901af718aSjoris 
1207bb3ddb0Sray #endif	/* DIFF_H */
121