* sim/ucsim/mkecho: inserted #!/bin/sh for Cygwin, so that it's executable
[fw/sdcc] / src / asm.c
index 70dbacd922b2d1a192fcfdfd930c0e0b13e4ab29..b22d352e269232a584926633aa9f1c73e3133afe 100644 (file)
--- a/src/asm.c
+++ b/src/asm.c
@@ -9,9 +9,12 @@
 #include "common.h"
 #include "asm.h"
 
-#if !defined(__BORLANDC__) && !defined(_MSC_VER)
-// for pipe and close
-#include <unistd.h>
+#if defined __MINGW32__
+   // for O_BINARY in _pipe()
+#  include <fcntl.h>
+#elif !defined(__BORLANDC__) && !defined(_MSC_VER)
+   // for pipe and close
+#  include <unistd.h>
 #endif
 
 /* A 'token' is like !blah or %24f and is under the programmers
@@ -220,7 +223,11 @@ char *printILine (iCode *ic) {
   FILE *pipeStream;
   iCodeTable *icTab=getTableEntry(ic->op);
   
+#if defined __MINGW32__
+  assert(_pipe(filedes, 256, O_BINARY)!=-1); // forget it
+#else
   assert(pipe(filedes)!=-1); // forget it
+#endif
 
   // stuff the pipe with the readable icode
   pipeStream=fdopen(filedes[1],"w");