Spaces:
Sleeping
Sleeping
cli : avoid std::exchange
Browse files- examples/cli/cli.cpp +4 -2
examples/cli/cli.cpp
CHANGED
|
@@ -9,7 +9,6 @@
|
|
| 9 |
#include <cstdio>
|
| 10 |
#include <string>
|
| 11 |
#include <thread>
|
| 12 |
-
#include <utility>
|
| 13 |
#include <vector>
|
| 14 |
#include <cstring>
|
| 15 |
|
|
@@ -1019,10 +1018,12 @@ int main(int argc, char ** argv) {
|
|
| 1019 |
|
| 1020 |
bool open(const char * ext, const char * function) {
|
| 1021 |
if (is_stdout) {
|
| 1022 |
-
if (
|
| 1023 |
fprintf(stderr, "warning: Not appending multiple file formats to stdout\n");
|
| 1024 |
return false;
|
| 1025 |
}
|
|
|
|
|
|
|
| 1026 |
#ifdef _WIN32
|
| 1027 |
fout = std::ofstream{"CON"};
|
| 1028 |
#else
|
|
@@ -1032,6 +1033,7 @@ int main(int argc, char ** argv) {
|
|
| 1032 |
// Also assuming /dev is mounted
|
| 1033 |
return true;
|
| 1034 |
}
|
|
|
|
| 1035 |
fname_out.resize(basename_length);
|
| 1036 |
fname_out += ext;
|
| 1037 |
fout = std::ofstream{fname_out};
|
|
|
|
| 9 |
#include <cstdio>
|
| 10 |
#include <string>
|
| 11 |
#include <thread>
|
|
|
|
| 12 |
#include <vector>
|
| 13 |
#include <cstring>
|
| 14 |
|
|
|
|
| 1018 |
|
| 1019 |
bool open(const char * ext, const char * function) {
|
| 1020 |
if (is_stdout) {
|
| 1021 |
+
if (used_stdout) {
|
| 1022 |
fprintf(stderr, "warning: Not appending multiple file formats to stdout\n");
|
| 1023 |
return false;
|
| 1024 |
}
|
| 1025 |
+
|
| 1026 |
+
used_stdout = true;
|
| 1027 |
#ifdef _WIN32
|
| 1028 |
fout = std::ofstream{"CON"};
|
| 1029 |
#else
|
|
|
|
| 1033 |
// Also assuming /dev is mounted
|
| 1034 |
return true;
|
| 1035 |
}
|
| 1036 |
+
|
| 1037 |
fname_out.resize(basename_length);
|
| 1038 |
fname_out += ext;
|
| 1039 |
fout = std::ofstream{fname_out};
|