21 #include "config_auto.h"
30 #define MAX_MSG_LEN 2048
32 static STRING_VAR(debug_file,
"",
"File to send tprintf output to");
37 const char* debug_file_name = debug_file.c_str();
38 static FILE *debugfp =
nullptr;
40 if (debug_file_name ==
nullptr) {
47 if (strcmp(debug_file_name,
"/dev/null") == 0) {
48 debug_file_name =
"nul";
49 debug_file.set_value(debug_file_name);
53 if (debugfp ==
nullptr && debug_file_name[0] !=
'\0') {
54 debugfp = fopen(debug_file_name,
"wb");
55 }
else if (debugfp !=
nullptr && debug_file_name[0] ==
'\0') {
61 va_start(args, format);
62 if (debugfp !=
nullptr) {
63 vfprintf(debugfp, format, args);
65 vfprintf(stderr, format, args);