1 #include "git-compat-util.h"
2 #include "systeminfo.h"
5 static char debug_git_file
[MAX_PATH
];
6 static FILE * debug_git_fd
= NULL
;
8 void debug_git_set_file(const char * filename
)
16 strncpy(debug_git_file
, filename
, MAX_PATH
);
17 debug_git_file
[MAX_PATH
-1] = '\0';
19 debug_git_fd
= fopen(debug_git_file
, "a+");
22 void debug_git(char * format
, ...)
26 debug_git_set_file(DEFAULT_DEBUG_GIT_FILE
);
29 /* Check again in case the above debug_git_set_file failed. */
36 va_start(params
, format
);
37 length
= vsnprintf(buffer
, sizeof(buffer
), format
, params
);
39 fwrite(buffer
, sizeof(char), length
, debug_git_fd
);
40 fputc('\n', debug_git_fd
);
45 void debug_git_mbox(char *format
, ...)
50 va_start(params
, format
);
51 vsnprintf(buffer
, sizeof(buffer
), format
, params
);