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 */
17 
18 #ifndef DIFFRUN_H
19 #define DIFFRUN_H
20 
21 /* This header file defines the interfaces used by the diff library.
22    It should be included by programs which use the diff library.  */
23 
24 #include <sys/types.h>
25 
26 #if defined __STDC__ && __STDC__
27 #define DIFFPARAMS(args) args
28 #else
29 #define DIFFPARAMS(args) ()
30 #endif
31 
32 /* The diff_callbacks structure is used to handle callbacks from the
33    diff library.  All output goes through these callbacks.  When a
34    pointer to this structure is passed in, it may be NULL.  Also, any
35    of the individual callbacks may be NULL.  This means that the
36    default action should be taken.  */
37 
38 struct diff_callbacks
39 {
40   /* Write output.  This function just writes a string of a given
41      length to the output file.  The default is to fwrite to OUTFILE.
42      If this callback is defined, flush_output must also be defined.
43      If the length is zero, output zero bytes.  */
44   void (*write_output) DIFFPARAMS((char const *, size_t));
45   /* Flush output.  The default is to fflush OUTFILE.  If this
46      callback is defined, write_output must also be defined.  */
47   void (*flush_output) DIFFPARAMS((void));
48   /* Write a '\0'-terminated string to stdout.
49      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 **, const 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