]> git.cworth.org Git - apitrace/blobdiff - cli/cli_pickle.cpp
Convert trim option parsing to getopt.
[apitrace] / cli / cli_pickle.cpp
index 6af879fa3da6960d7aca1a02b2c06cf8e27e2b4a..c37c0f8bf8c85d00d4a83484bb9eab294c903c6d 100644 (file)
 
 #include <string.h>
 
-#ifdef _WIN32
-#include <fcntl.h>
-#include <io.h>
-#endif
-
 #include "pickle.hpp"
 
+#include "os_binary.hpp"
+
 #include "cli.hpp"
 #include "cli_pager.hpp"
 
@@ -189,14 +186,7 @@ command(int argc, char *argv[])
         }
     }
 
-#ifdef _WIN32
-    // Set stdout in binary mode
-    fflush(stdout);
-    int mode = _setmode(_fileno(stdout), _O_BINARY);
-    if (mode == -1) {
-        std::cerr << "warning: failed to set stdout in binary mode\n";
-    }
-#endif
+    os::setBinaryMode(stdout);
 
     for (; i < argc; ++i) {
         trace::Parser parser;
@@ -218,14 +208,6 @@ command(int argc, char *argv[])
         }
     }
 
-#ifdef _WIN32
-    std::cout.flush();
-    fflush(stdout);
-    if (mode != -1) {
-        _setmode(_fileno(stdout), mode);
-    }
-#endif
-
     return 0;
 }