dvitomp fix from Akira
[mplib] / src / texk / kpathsea / debug.c
1 /* debug.c: help the user discover what's going on.
2
3    Copyright 1993, 1994, 2008 Karl Berry.
4
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public License
16    along with this library; if not, see <http://www.gnu.org/licenses/>.  */
17
18 #include <kpathsea/config.h>
19
20 #ifdef KPSE_DEBUG /* whole file */
21
22 unsigned kpathsea_debug = 0;
23
24 /* If the real definitions of fopen or fclose are macros, we lose -- the
25    #undef won't restore them. */
26
27 FILE *
28 fopen P2C(const_string, filename,  const_string, mode)
29 {
30 #undef fopen
31   FILE *ret = fopen (filename, mode);
32
33   if (KPSE_DEBUG_P (KPSE_DEBUG_FOPEN))
34     DEBUGF3 ("fopen(%s, %s) => 0x%lx\n", filename, mode, (unsigned long) ret);
35
36   return ret;
37 }
38
39 int
40 fclose P1C(FILE *, f)
41 {
42 #undef fclose
43   int ret = fclose (f);
44   
45   if (KPSE_DEBUG_P (KPSE_DEBUG_FOPEN))
46     DEBUGF2 ("fclose(0x%lx) => %d\n", (unsigned long) f, ret);
47
48   return ret;
49 }
50
51 #endif /* KPSE DEBUG */