diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2021-12-08 13:01:40 +0100 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2021-12-08 14:48:20 +0100 |
commit | 1da78b58187ba29ad618233b4cd38b159412909e (patch) | |
tree | 00e8353aad1ebac208347e39fe4981c977b27f73 /CRT.c | |
parent | 2ae19064791306b8cd7c741cf3431bde58d77136 (diff) |
CRT: add debug printing function
Diffstat (limited to 'CRT.c')
-rw-r--r-- | CRT.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -13,6 +13,7 @@ in the source distribution for its full text. #include <fcntl.h> #include <langinfo.h> #include <signal.h> +#include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -844,6 +845,16 @@ static void dumpStderr(void) { stderrRedirectNewFd = -1; } +void CRT_debug_impl(const char* file, size_t lineno, const char* func, const char* fmt, ...) { + va_list args; + + fprintf(stderr, "[%s:%zu (%s)]: ", file, lineno, func); + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); + fprintf(stderr, "\n"); +} + #else /* !NDEBUG */ static void redirectStderr(void) { |