* sim/ucsim/mkecho: inserted #!/bin/sh for Cygwin, so that it's executable
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 16 Feb 2003 14:48:14 +0000 (14:48 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 16 Feb 2003 14:48:14 +0000 (14:48 +0000)
* src/asm.c: fix pipe() for Mingw32

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2275 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
sim/ucsim/mkecho
src/asm.c

index cdecb3ff492500091ed21cd241d15b1e9aa6dade..8d49de6b6876d04149da619df83c4d35d4cb150c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-02-16  Bernhard Held <bernhard@bernhardheld.de>
+
+       * sim/ucsim/mkecho: inserted #!/bin/sh for Cygwin, so that it's executable
+       * src/asm.c: fix pipe() for Mingw32
+
 2003-02-15  Bernhard Held <bernhard@bernhardheld.de>
 
        * src/SDCCglue.h: make tmpfileNameSet available for preOutName
index 7e2047d937ad0d0e015caa195d584839a68a3971..4718b7dab578b698dffd933849a43718a25a079c 100755 (executable)
@@ -1,3 +1,4 @@
+#!/bin/sh
 if [ -f ${1}/devel ]; then
        shift
        echo "$@"
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");