From a7738f4dc72c9445623cd6f5348d7a80d4e52690 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Sun, 9 Oct 2022 17:57:05 -0400 Subject: initial commit, straight from apt-get source --- dbg.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 dbg.h (limited to 'dbg.h') diff --git a/dbg.h b/dbg.h new file mode 100644 index 0000000..f85bff3 --- /dev/null +++ b/dbg.h @@ -0,0 +1,25 @@ +#include + +#define ERR(fmt, args...) fprintf(stderr, fmt, ## args) +#define DBG2(fmt, args...) fprintf(stderr, "%s:%-5d: " fmt, __FUNCTION__, __LINE__, ## args) +#define ENTER2 do { fprintf(stderr, "%s:%-5d: ENTER\n", __FUNCTION__, __LINE__); } while(0) +#define RET2(args...) do { fprintf(stderr, "%s:%-5d: RETURN\n", __FUNCTION__, __LINE__);\ +return args; } while(0) +#define DBG3(fmt, args...) fprintf(stderr, fmt, ## args) + +#ifdef DEBUG + +#define ENTER do { fprintf(stderr, "%s:%-5d: ENTER\n", __FUNCTION__, __LINE__); } while(0) +#define RET(args...) do { fprintf(stderr, "%s:%-5d: RETURN\n", __FUNCTION__, __LINE__);\ +return args; } while(0) +#define DBG(fmt, args...) fprintf(stderr, "%s:%-5d: " fmt, __FUNCTION__, __LINE__, ## args) + +#else + + +#define ENTER do { } while(0) +#define RET(args...) return args; +#define DBG(fmt, args...) do { } while(0) + +#endif + -- cgit