aboutsummaryrefslogtreecommitdiffstats
path: root/iceprog
diff options
context:
space:
mode:
authorTim Pambor <tp@osasysteme.de>2019-08-05 11:51:03 +0200
committerTim Pambor <tp@osasysteme.de>2019-08-05 11:51:03 +0200
commit26a40d0e114c5f9025718b511d45f2da09259c1c (patch)
treed16a73e03dbe5301bc0c5c30f8a8d74e213fa68c /iceprog
parent792cef084a751e32f541332feb4905f8e49e9943 (diff)
downloadicestorm-26a40d0e114c5f9025718b511d45f2da09259c1c.tar.gz
icestorm-26a40d0e114c5f9025718b511d45f2da09259c1c.tar.bz2
icestorm-26a40d0e114c5f9025718b511d45f2da09259c1c.zip
Fix piping on windows
On windows stdin and stdout have to be set to binary as otherwise windows treats it as text and converts occurences of CRLF to LF
Diffstat (limited to 'iceprog')
-rw-r--r--iceprog/iceprog.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/iceprog/iceprog.c b/iceprog/iceprog.c
index bae9e71..aaba285 100644
--- a/iceprog/iceprog.c
+++ b/iceprog/iceprog.c
@@ -35,6 +35,11 @@
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef _WIN32
+#include <io.h> /* _setmode() */
+#include <fcntl.h> /* _O_BINARY */
+#endif
+
#include "mpsse.h"
static bool verbose = false;
@@ -523,6 +528,11 @@ int main(int argc, char **argv)
const char *devstr = NULL;
int ifnum = 0;
+#ifdef _WIN32
+ _setmode(_fileno(stdin), _O_BINARY);
+ _setmode(_fileno(stdout), _O_BINARY);
+#endif
+
static struct option long_options[] = {
{"help", no_argument, NULL, -2},
{NULL, 0, NULL, 0}