summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/util.c b/util.c
index 88a6d4f..26dfc9c 100644
--- a/util.c
+++ b/util.c
@@ -477,13 +477,16 @@ void warning(char *format, ...)
va_end(args);
}
+static uint8_t output_enabled = 1;
void info_message(char *format, ...)
{
va_list args;
va_start(args, format);
#ifndef _WIN32
if (headless || (isatty(STDOUT_FILENO) && isatty(STDIN_FILENO))) {
- info_printf(format, args);
+ if (output_enabled) {
+ info_printf(format, args);
+ }
} else {
#endif
int32_t size = strlen(format) * 2;
@@ -503,7 +506,9 @@ void info_message(char *format, ...)
va_start(args, format);
vsnprintf(buf, actual, format, args);
}
- info_puts(buf);
+ if (output_enabled) {
+ info_puts(buf);
+ }
render_infobox("BlastEm Info", buf);
free(buf);
#ifndef _WIN32
@@ -512,6 +517,20 @@ void info_message(char *format, ...)
va_end(args);
}
+void debug_message(char *format, ...)
+{
+ va_list args;
+ va_start(args, format);
+ if (output_enabled) {
+ info_printf(format, args);
+ }
+}
+
+void disable_stdout_messages(void)
+{
+ output_enabled = 0;
+}
+
#ifdef _WIN32
#include <windows.h>
#include <shlobj.h>