diff options
Diffstat (limited to 'libsbutil')
-rw-r--r-- | libsbutil/sb_efuncs.c | 14 | ||||
-rw-r--r-- | libsbutil/sbutil.h | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/libsbutil/sb_efuncs.c b/libsbutil/sb_efuncs.c index 2de3116..7ded90d 100644 --- a/libsbutil/sb_efuncs.c +++ b/libsbutil/sb_efuncs.c @@ -48,7 +48,8 @@ static void sb_vefunc(const char *prog, const char *color, const char *format, v if (fd == -1) fd = fileno(stderr); - sb_fdprintf(fd, " %s*%s ", color, COLOR_NORMAL); + if (color) + sb_fdprintf(fd, " %s*%s ", color, COLOR_NORMAL); sb_vfdprintf(fd, format, args); if (opened) @@ -98,6 +99,17 @@ void sb_eqawarn(const char *format, ...) va_end(args); } +/* This is a bit of a hack to expose the same file logic to generic printers. + * Probably want to revisit sb_vefunc and move the guts there to a new func. + */ +void sb_eraw(const char *format, ...) +{ + va_list args; + va_start(args, format); + sb_vefunc(NULL, NULL, format, args); + va_end(args); +} + void sb_dump_backtrace(void) { #ifdef HAVE_BACKTRACE diff --git a/libsbutil/sbutil.h b/libsbutil/sbutil.h index 15979da..66c6f73 100644 --- a/libsbutil/sbutil.h +++ b/libsbutil/sbutil.h @@ -112,6 +112,7 @@ __printf(1, 2) void sb_ewarn(const char *format, ...); __printf(1, 2) void sb_eerror(const char *format, ...); __printf(1, 2) void sb_eqawarn(const char *format, ...); __printf(1, 2) void sb_debug_dyn(const char *format, ...); +__printf(1, 2) void sb_eraw(const char *format, ...); __printf(4, 5) void __sb_ebort(const char *file, const char *func, size_t line_num, const char *format, ...) __noreturn; #define sb_ebort(format, ...) __sb_ebort(__FILE__, __func__, __LINE__, format, ## __VA_ARGS__) void sb_dump_backtrace(void); |