xref: /openbsd-src/gnu/usr.bin/cvs/diff/diffrun.h (revision b2346922a76a50a89e33beab4ebbc0950de8a8df)
1 /* Interface header file for GNU DIFF library.
2    Copyright (C) 1998 Free Software Foundation, Inc.
3 
4 This file is part of GNU DIFF.
5 
6 GNU DIFF is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10 
11 GNU DIFF is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GNU DIFF; see the file COPYING.  If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
19 
20 #ifndef DIFFRUN_H
21 #define DIFFRUN_H
22 
23 /* This header file defines the interfaces used by the diff library.
24    It should be included by programs which use the diff library.  */
25 
26 #include <sys/types.h>
27 
28 #if defined __STDC__ && __STDC__
29 #define DIFFPARAMS(args) args
30 #else
31 #define DIFFPARAMS(args) ()
32 #endif
33 
34 /* The diff_callbacks structure is used to handle callbacks from the
35    diff library.  All output goes through these callbacks.  When a
36    pointer to this structure is passed in, it may be NULL.  Also, any
37    of the individual callbacks may be NULL.  This means that the
38    default action should be taken.  */
39 
40 struct diff_callbacks
41 {
42   /* Write output.  This function just writes a string of a given
43      length to the output file.  The default is to fwrite to OUTFILE.
44      If this callback is defined, flush_output must also be defined.  */
45   void (*write_output) DIFFPARAMS((char const *, size_t));
46   /* Flush output.  The default is to fflush OUTFILE.  If this
47      callback is defined, write_output must also be defined.  */
48   void (*flush_output) DIFFPARAMS((void));
49   /* Write to stdout.  This is called for version and help messages.  */
50   void (*write_stdout) DIFFPARAMS((char const *));
51   /* Print an error message.  The first argument is a printf format,
52      and the next two are parameters.  The default is to print a
53      message on stderr.  */
54   void (*error) DIFFPARAMS((char const *, char const *, char const *));
55 };
56 
57 /* Run a diff.  */
58 
59 extern int diff_run DIFFPARAMS((int, char **, char *,
60 				const struct diff_callbacks *));
61 
62 /* Run a diff3.  */
63 
64 extern int diff3_run DIFFPARAMS((int, char **, char *,
65 				 const struct diff_callbacks *));
66 
67 #undef DIFFPARAMS
68 
69 #endif /* DIFFRUN_H */
70