From 20c5fc1767436ee106156a9aabf6545e72a4b519 Mon Sep 17 00:00:00 2001 From: Michał Cichoń Date: Thu, 10 Dec 2015 01:02:02 +0100 Subject: Use custom function to feed console instead of trying to be clever and capturing stdout. This fixes IO on Windows 8 and Windows 10. --- src/ui.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/ui.c') diff --git a/src/ui.c b/src/ui.c index aaa83ae..8efc7aa 100644 --- a/src/ui.c +++ b/src/ui.c @@ -75,7 +75,7 @@ static const char *BarStrCaseStr (const char *haystack, const char *needle) { return NULL; } -char* BatStrFormat (const char* format, va_list args) { +char* BarStrFormat (const char* format, va_list args) { static const size_t c_initial_buffer_size = 256; char* buffer = malloc(c_initial_buffer_size); @@ -117,7 +117,7 @@ void BarUiMsg (const BarSettings_t *settings, const BarUiMsg_t type, case MSG_DEBUG: /* print ANSI clear line */ - fputs ("\033[2K", stdout); + BarConsolePuts("\033[2K"); break; default: @@ -125,14 +125,14 @@ void BarUiMsg (const BarSettings_t *settings, const BarUiMsg_t type, } if (settings->msgFormat[type].prefix != NULL) { - fputs (settings->msgFormat[type].prefix, stdout); + BarConsolePuts(settings->msgFormat[type].prefix); } va_start (fmtargs, format); - vprintf (format, fmtargs); + BarConsolePrintV (format, fmtargs); if (type == MSG_DEBUG) { - char* msg = BatStrFormat (format, fmtargs); + char* msg = BarStrFormat (format, fmtargs); if (msg != NULL) { BarConsoleSetClipboard (msg); free (msg); @@ -142,10 +142,10 @@ void BarUiMsg (const BarSettings_t *settings, const BarUiMsg_t type, va_end (fmtargs); if (settings->msgFormat[type].postfix != NULL) { - fputs (settings->msgFormat[type].postfix, stdout); + BarConsolePuts(settings->msgFormat[type].postfix); } - fflush (stdout); + BarConsoleFlush(); } /* piano wrapper: prepare/execute http request and pass result back to -- cgit v1.2.3