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