13 # define COMMIT_FLAG "c" 15 # define COMMIT_FLAG "" 18 #if defined _WIN64 || defined _WIN32 19 #define strcasecmp _stricmp 51 }
else if (d->
df != NULL) {
52 fprintf(d->
df,
"%s", text);
60 char buffer[3000], timestamp[60];
70 result = vsnprintf(buffer,
sizeof(buffer) - 1, format, argp);
76 end = strstr(pos,
"\n");
83 sprintf(timestamp,
"%s %4d/%02d/%02d %02d:%02d:%02d: ",
110 pos = end + strlen(
"\n");
131 if (privdi->
df != NULL
132 && fileno(privdi->
df) != fileno(stderr)
133 && fileno(privdi->
df) != fileno(stdout)
148 if (info == NULL || strlen(info) == 0) {
152 switch (privdi->
dl) {
159 if (testfile != NULL) {
160 fseek(testfile, 0, SEEK_END);
161 if (ftell(testfile) > 5000000) {
171 if (testfile == NULL) {
172 dbgprintf(privdi,
"Can't open debug file\n");
192 if (strcasecmp(info,
"nothing") == 0) {
196 if (strcasecmp(info,
"text") == 0) {
200 if (strcasecmp(info,
"textall") == 0) {
204 if (strcasecmp(info,
"binary") == 0) {
208 if (strcasecmp(info,
"errors") == 0) {
212 if (strcasecmp(info,
"textdate") == 0) {
216 if (strcasecmp(info,
"textalldate") == 0) {
220 if (strcasecmp(info,
"errorsdate") == 0) {
246 if (d == NULL || d->use_global) {
252 va_start(argp, format);
269 va_start(argp, format);
293 }
else if (severity ==
D_ERROR) {
303 va_start(argp, format);
311 #define CHARS_PER_LINE (16) 321 if (messagesize == 0)
return;
326 for (i = 0; i < messagesize; i++) {
328 snprintf(buffer + (j * 4), 3,
"%02X", message[i]);
329 buffer[(j * 4) + 2] =
' ';
332 if (isprint(message[i])
334 && message[i] != 0x09
336 && message[i] != 0x01
338 && message[i] != 0x85
339 && message[i] != 0x95
340 && message[i] != 0xA6
341 && message[i] != 0xB7) {
342 buffer[(j * 4) + 2] = message[i];
350 buffer[j * 4 + 3] =
'|';
369 #undef CHARS_PER_LINE
GSM_Error GSM_SetDebugFunction(GSM_Log_Function info, void *data, GSM_Debug_Info *privdi)
void DumpMessage(GSM_Debug_Info *d, const unsigned char *message, const size_t messagesize)
GSM_Debug_Info * GSM_GetDI(GSM_StateMachine *s)
GSM_Log_Function log_function
gboolean GSM_SetDebugCoding(const char *info, GSM_Debug_Info *privdi)
void DumpMessageText(GSM_Debug_Info *d, const unsigned char *message, const size_t messagesize)
char * DayOfWeek(unsigned int year, unsigned int month, unsigned int day)
GSM_Error GSM_SetDebugFileDescriptor(FILE *fd, gboolean closable, GSM_Debug_Info *privdi)
#define PRINTF_STYLE(f, a)
void(* GSM_Log_Function)(const char *text, void *data)
int smprintf_level(GSM_StateMachine *s, GSM_DebugSeverity severity, const char *format,...)
gboolean GSM_SetDebugGlobal(gboolean info, GSM_Debug_Info *privdi)
GSM_Debug_Info GSM_global_debug
GSM_Error GSM_SetDebugFile(const char *info, GSM_Debug_Info *privdi)
int dbg_vprintf(GSM_Debug_Info *d, const char *format, va_list argp)
void GSM_GetCurrentDateTime(GSM_DateTime *Date)
gboolean GSM_SetDebugLevel(const char *info, GSM_Debug_Info *privdi)
int smfprintf(GSM_Debug_Info *d, const char *format,...)
void dbg_write(GSM_Debug_Info *d, const char *text)
GSM_Debug_Info GSM_none_debug
int smprintf(GSM_StateMachine *s, const char *format,...)