summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2014-12-31 16:44:46 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2014-12-31 17:14:01 +0100
commitfc9c8eed3d1b7f7608b8451c53b214e502f1b8f1 (patch)
tree2f36a27f44a2ffb1ee14f0ff8ef3ef9db334800a /src/main.c
parente9e8fa617a666b9ef36fb47dedb3d0fe96dfca48 (diff)
Write to stdout in binary mode on Windows
This fixes the output of newlines.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index b2027ee..e849b82 100644
--- a/src/main.c
+++ b/src/main.c
@@ -7,6 +7,11 @@
#include "debug.h"
#include "bench.h"
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ #include <io.h>
+ #include <fcntl.h>
+#endif
+
typedef enum {
FORMAT_NONE,
FORMAT_HTML,
@@ -58,6 +63,10 @@ int main(int argc, char *argv[])
writer_format writer = FORMAT_HTML;
long options = CMARK_OPT_DEFAULT;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ _setmode(_fileno(stdout), _O_BINARY);
+#endif
+
parser = cmark_parser_new();
files = (int *)malloc(argc * sizeof(*files));