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