mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-15 21:44:36 +03:00
CRT: add debug printing function
This commit is contained in:
11
CRT.c
11
CRT.c
@ -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) {
|
||||
|
Reference in New Issue
Block a user