1 /*
2 
3    ratproxy - debugging macros
4    ---------------------------
5 
6    Author: Michal Zalewski <lcamtuf@google.com>
7 
8    Copyright 2007, 2008 by Google Inc. All Rights Reserved.
9 
10    Licensed under the Apache License, Version 2.0 (the "License");
11    you may not use this file except in compliance with the License.
12    You may obtain a copy of the License at
13 
14      http://www.apache.org/licenses/LICENSE-2.0
15 
16    Unless required by applicable law or agreed to in writing, software
17    distributed under the License is distributed on an "AS IS" BASIS,
18    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19    See the License for the specific language governing permissions and
20    limitations under the License.
21 
22 */
23 
24 #ifndef _HAVE_DEBUG_H
25 #define _HAVE_DEBUG_H
26 
27 #include "types.h"
28 
29 #define debug(x...) fprintf(stderr,x)
30 
31 #define fatal(x...) do { \
32     debug("PROGRAM ABORT: " x); \
33     debug(" [%s(), %s:%u]\n",__FUNCTION__,__FILE__,__LINE__); \
34     exit(1); \
35   } while (0)
36 
37 #define pfatal(x...) do { \
38     debug( "SYSTEM ERROR : " x); \
39     debug( " [%s(), %s:%u]\n",__FUNCTION__,__FILE__,__LINE__); \
40     perror("     Message "); \
41     exit(1); \
42   } while (0)
43 
44 
45 #endif /* ! _HAVE_DEBUG_H */
46