22 #include "config_auto.h" 32 #define MAX_MSG_LEN 65536 34 static STRING_VAR(debug_file,
"",
"File to send tprintf output to");
41 static FILE *debugfp =
nullptr;
46 va_start(args, format);
49 offset += _vsnprintf(msg + offset,
MAX_MSG_LEN - offset, format, args);
50 if (strcmp(debug_file.string(),
"/dev/null") == 0)
51 debug_file.set_value(
"nul");
53 offset += vsnprintf(msg + offset,
MAX_MSG_LEN - offset, format, args);
57 if (debugfp ==
nullptr && strlen(debug_file.string()) > 0) {
58 debugfp = fopen(debug_file.string(),
"wb");
59 }
else if (debugfp !=
nullptr && strlen(debug_file.string()) == 0) {
63 if (debugfp !=
nullptr)
64 fprintf(debugfp,
"%s", msg);
66 fprintf(stderr,
"%s", msg);
#define STRING_VAR(name, val, comment)
DLLSYM void tprintf(const char *format,...)