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