summaryrefslogtreecommitdiffstats
path: root/heimdall/source/Interface.cpp
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2014-05-09 17:25:20 +0200
committerBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2014-05-09 17:27:19 +0200
commitb518fdc9f66f264b7f0b4d2c47f7926800e45ef4 (patch)
treec0d36930ab265fb6026c563f1651b076eba4fbae /heimdall/source/Interface.cpp
parentRemoved a few unused variables. (diff)
parentfix --stdout-errors handling (diff)
downloadHeimdall-b518fdc9f66f264b7f0b4d2c47f7926800e45ef4.tar
Heimdall-b518fdc9f66f264b7f0b4d2c47f7926800e45ef4.tar.gz
Heimdall-b518fdc9f66f264b7f0b4d2c47f7926800e45ef4.tar.bz2
Heimdall-b518fdc9f66f264b7f0b4d2c47f7926800e45ef4.tar.lz
Heimdall-b518fdc9f66f264b7f0b4d2c47f7926800e45ef4.tar.xz
Heimdall-b518fdc9f66f264b7f0b4d2c47f7926800e45ef4.tar.zst
Heimdall-b518fdc9f66f264b7f0b4d2c47f7926800e45ef4.zip
Diffstat (limited to 'heimdall/source/Interface.cpp')
-rw-r--r--heimdall/source/Interface.cpp72
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)