aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2019-08-15 13:29:46 +0200
committerGitHub <noreply@github.com>2019-08-15 13:29:46 +0200
commitc59638c624d794e845cf00cd90ca6fc1ec5f37b5 (patch)
tree7b7433f1ed5884ea998df31a55aebfed7b4061a8
parent2ccae0d3864fd7268118287a85963c0116745cff (diff)
parent26a40d0e114c5f9025718b511d45f2da09259c1c (diff)
downloadicestorm-c59638c624d794e845cf00cd90ca6fc1ec5f37b5.tar.gz
icestorm-c59638c624d794e845cf00cd90ca6fc1ec5f37b5.tar.bz2
icestorm-c59638c624d794e845cf00cd90ca6fc1ec5f37b5.zip
Merge pull request #229 from tpambor/win-piping
Fix piping on windows
-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}