Skip to content

Commit 2277795

Browse files
committed
adding specific debug options for files and functions
1 parent 49a5567 commit 2277795

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

cutils.a

236 Bytes
Binary file not shown.

cutils.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ enum level {
9696
};
9797

9898
extern int DEBUG;
99-
extern char* DEBUG_UNIT;
99+
extern char* DEBUG_FN;
100+
extern char* DEBUG_FILE;
100101

101102
// a tool to have cool terminal output
102103
int msg(enum level msgLevel, const char* message,...);

obj/msg.o

224 Bytes
Binary file not shown.

src/msg.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
#include "../cutils.h"
77

88
int DEBUG = 0;
9-
char* DEBUG_UNIT = NULL;
9+
char* DEBUG_FN = NULL;
10+
char* DEBUG_FILE = NULL;
1011

1112
#define RESET "\033[0m"
1213
#define BLACK "\033[30m" /* Black */
@@ -71,8 +72,14 @@ int f_dbg__(int level,int line,const char* function,const char* file,char* messa
7172

7273
file = strrchr(file,'/')+1;
7374
/* WARNING : EXPERIMENTAL */
74-
if (DEBUG_UNIT != NULL) {
75-
if (strcmp(DEBUG_UNIT,function) != 0) {
75+
if (DEBUG_FN != NULL) {
76+
if (strcmp(DEBUG_FN,function) != 0) {
77+
return 1;
78+
}
79+
}
80+
81+
if (DEBUG_FILE != NULL) {
82+
if (strcmp(DEBUG_FILE,file) != 0) {
7683
return 1;
7784
}
7885
}

0 commit comments

Comments
 (0)