Back to index

tetex-bin  3.0
debug.c
Go to the documentation of this file.
00001 /* debug.c: Help the user discover what's going on.
00002 
00003 Copyright (C) 1993, 94 Karl Berry.
00004 
00005 This library is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU Library General Public
00007 License as published by the Free Software Foundation; either
00008 version 2 of the License, or (at your option) any later version.
00009 
00010 This library is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 Library General Public License for more details.
00014 
00015 You should have received a copy of the GNU Library General Public
00016 License along with this library; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00018 
00019 #include <kpathsea/config.h>
00020 
00021 #ifdef KPSE_DEBUG /* whole file */
00022 
00023 unsigned kpathsea_debug = 0;
00024 
00025 /* If the real definitions of fopen or fclose are macros, we lose -- the
00026    #undef won't restore them. */
00027 
00028 FILE *
00029 fopen P2C(const_string, filename,  const_string, mode)
00030 {
00031 #undef fopen
00032   FILE *ret = fopen (filename, mode);
00033 
00034   if (KPSE_DEBUG_P (KPSE_DEBUG_FOPEN))
00035     DEBUGF3 ("fopen(%s, %s) => 0x%lx\n", filename, mode, (unsigned long) ret);
00036 
00037   return ret;
00038 }
00039 
00040 int
00041 fclose P1C(FILE *, f)
00042 {
00043 #undef fclose
00044   int ret = fclose (f);
00045   
00046   if (KPSE_DEBUG_P (KPSE_DEBUG_FOPEN))
00047     DEBUGF2 ("fclose(0x%lx) => %d\n", (unsigned long) f, ret);
00048 
00049   return ret;
00050 }
00051 
00052 #endif /* KPSE DEBUG */