diff options
author | Martin Willers <M.Willers@gmx.net> | 2014-05-08 12:32:56 +0200 |
---|---|---|
committer | Benjamin Dobell <benjamin.dobell+git@glassechidna.com.au> | 2014-05-09 17:22:22 +0200 |
commit | d5cd49b73c3dfaf5b1188030a6bc9fc597edae8a (patch) | |
tree | d7ac13957f87aabbc6e5702de34fffa6d4ffcc25 /heimdall | |
parent | Updated copyright notices to 2014 (diff) | |
download | Heimdall-d5cd49b73c3dfaf5b1188030a6bc9fc597edae8a.tar Heimdall-d5cd49b73c3dfaf5b1188030a6bc9fc597edae8a.tar.gz Heimdall-d5cd49b73c3dfaf5b1188030a6bc9fc597edae8a.tar.bz2 Heimdall-d5cd49b73c3dfaf5b1188030a6bc9fc597edae8a.tar.lz Heimdall-d5cd49b73c3dfaf5b1188030a6bc9fc597edae8a.tar.xz Heimdall-d5cd49b73c3dfaf5b1188030a6bc9fc597edae8a.tar.zst Heimdall-d5cd49b73c3dfaf5b1188030a6bc9fc597edae8a.zip |
Diffstat (limited to 'heimdall')
-rw-r--r-- | heimdall/source/Interface.cpp | 72 |
1 files changed, 42 insertions, 30 deletions
diff --git a/heimdall/source/Interface.cpp b/heimdall/source/Interface.cpp index 4a300ca..fd989fa 100644 --- a/heimdall/source/Interface.cpp +++ b/heimdall/source/Interface.cpp @@ -92,74 +92,86 @@ void Interface::Print(const char *format, ...) void Interface::PrintWarning(const char *format, ...) { - va_list args; - va_start(args, format); - - fprintf(stderr, "WARNING: "); - vfprintf(stderr, format, args); - fflush(stderr); + va_list stderrArgs; + va_start(stderrArgs, format); if (stdoutErrors) { + va_list stdoutArgs; + va_copy(stdoutArgs, stderrArgs); fprintf(stdout, "WARNING: "); - vfprintf(stdout, format, args); + vfprintf(stdout, format, stdoutArgs); fflush(stdout); + va_end(stdoutArgs); } - va_end(args); + fprintf(stderr, "WARNING: "); + vfprintf(stderr, format, stderrArgs); + fflush(stderr); + + va_end(stderrArgs); } void Interface::PrintWarningSameLine(const char *format, ...) { - va_list args; - va_start(args, format); - - vfprintf(stderr, format, args); - fflush(stderr); + va_list stderrArgs; + va_start(stderrArgs, format); if (stdoutErrors) { - vfprintf(stdout, format, args); + va_list stdoutArgs; + va_copy(stdoutArgs, stderrArgs); + vfprintf(stdout, format, stdoutArgs); fflush(stdout); + va_end(stdoutArgs); } - va_end(args); + vfprintf(stderr, format, stderrArgs); + fflush(stderr); + + va_end(stderrArgs); } void Interface::PrintError(const char *format, ...) { - va_list args; - va_start(args, format); - - fprintf(stderr, "ERROR: "); - vfprintf(stderr, format, args); - fflush(stderr); + va_list stderrArgs; + va_start(stderrArgs, format); if (stdoutErrors) { + va_list stdoutArgs; + va_copy(stdoutArgs, stderrArgs); fprintf(stdout, "ERROR: "); - vfprintf(stdout, format, args); + vfprintf(stdout, format, stdoutArgs); fflush(stdout); + va_end(stdoutArgs); } - va_end(args); + fprintf(stderr, "ERROR: "); + vfprintf(stderr, format, stderrArgs); + fflush(stderr); + + va_end(stderrArgs); } void Interface::PrintErrorSameLine(const char *format, ...) { - va_list args; - va_start(args, format); - - vfprintf(stderr, format, args); - fflush(stderr); + va_list stderrArgs; + va_start(stderrArgs, format); if (stdoutErrors) { - vfprintf(stdout, format, args); + va_list stdoutArgs; + va_copy(stdoutArgs, stderrArgs); + vfprintf(stdout, format, stdoutArgs); fflush(stdout); + va_end(stdoutArgs); } - va_end(args); + vfprintf(stderr, format, stderrArgs); + fflush(stderr); + + va_end(stderrArgs); } void Interface::PrintVersion(void) |