2 Unix SMB/Netbios implementation.
5 Copyright (C) Andrew Tridgell 1992-1998
6 Copyright (C) John H Terpstra 1996-1998
7 Copyright (C) Luke Kenneth Casson Leighton 1996-1998
8 Copyright (C) Paul Ashton 1998
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 /* -------------------------------------------------------------------------- **
29 * Debugging code. See also debug.c
32 /* mkproto.awk has trouble with ifdef'd function definitions (it ignores
33 * the #ifdef directive and will read both definitions, thus creating two
34 * diffferent prototype declarations), so we must do these by hand.
36 /* I know the __attribute__ stuff is ugly, but it does ensure we get the
37 arguemnts to DEBUG() right. We have got them wrong too often in the
41 int Debug1( char *, ... )
43 __attribute__ ((format (printf
, 1, 2)))
46 BOOL
dbgtext( char *, ... )
48 __attribute__ ((format (printf
, 1, 2)))
56 /* If we have these macros, we can add additional info to the header. */
57 #ifdef HAVE_FILE_MACRO
58 #define FILE_MACRO (__FILE__)
60 #define FILE_MACRO ("")
63 #ifdef HAVE_FUNCTION_MACRO
64 #define FUNCTION_MACRO (__FUNCTION__)
66 #define FUNCTION_MACRO ("")
70 * DEBUGLVL() - If level is <= the system-wide DEBUGLEVEL then generate a
71 * header using the default macros for file, line, and
73 * Returns True if the debug level was <= DEBUGLEVEL.
76 * dbgtext( "Some text.\n" );
77 * DEGUG() - Good old DEBUG(). Each call to DEBUG() will generate a new
78 * header *unless* the previous debug output was unterminated
79 * (i.e., no '\n'). See debug.c:dbghdr() for more info.
81 * DEBUG( 2, ("Some text.\n") );
82 * DEBUGADD() - If level <= DEBUGLEVEL, then the text is appended to the
83 * current message (i.e., no header).
85 * DEBUGADD( 2, ("Some additional text.\n") );
87 #define DEBUGLVL( level ) \
88 ( (DEBUGLEVEL >= (level)) \
89 && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) )
91 #define DEBUG( level, body ) \
92 (void)( (DEBUGLEVEL >= (level)) \
93 && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \
96 #define DEBUGADD( level, body ) \
97 (void)( (DEBUGLEVEL >= (level)) && (dbgtext body) )
99 /* -------------------------------------------------------------------------- **
100 * These are the tokens returned by dbg_char2token().
117 /* End Debugging code section.
118 * -------------------------------------------------------------------------- **