[project @ 1999-07-03 18:45:04 by sof]
authorsof <unknown>
Sat, 3 Jul 1999 18:45:04 +0000 (18:45 +0000)
committersof <unknown>
Sat, 3 Jul 1999 18:45:04 +0000 (18:45 +0000)
Don't compile in WinSock support under cygwin

ghc/lib/std/cbits/closeFile.c
ghc/lib/std/cbits/fileObject.c
ghc/lib/std/cbits/filePutc.c
ghc/lib/std/cbits/freeFile.c
ghc/lib/std/cbits/readFile.c
ghc/lib/std/cbits/writeFile.c

index cd8e6d1..3313724 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: closeFile.c,v 1.4 1999/05/05 10:33:14 sof Exp $
+ * $Id: closeFile.c,v 1.5 1999/07/03 18:45:04 sof Exp $
  *
  * hClose Runtime Support
  */
@@ -9,7 +9,11 @@
 #include "Rts.h"
 #include "stgio.h"
 
-#ifdef HAVE_WINSOCK_H
+#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
+#define USE_WINSOCK
+#endif
+
+#ifdef USE_WINSOCK
 #include <winsock.h>
 #endif
 
@@ -70,7 +74,7 @@ StgInt flush_buf;
       /* Regardless of success or otherwise, the fd field gets smashed. */
       while ( (rc = 
                (
-#ifdef HAVE_WINSOCK_H
+#ifdef USE_WINSOCK
                  fo->flags & FILEOBJ_WINSOCK ?
                  closesocket(fo->fd) :
                   close(fo->fd))) != 0 ) {
index badb5c7..15d3c33 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: fileObject.c,v 1.3 1999/05/05 10:33:14 sof Exp $
+ * $Id: fileObject.c,v 1.4 1999/07/03 18:45:04 sof Exp $
  *
  * hPutStr Runtime Support
  */
 
 #include <stdio.h>
 
-#ifdef HAVE_WINSOCK_H
+#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
+#define USE_WINSOCK
+#endif
+
+#ifdef USE_WINSOCK
 #include <winsock.h>
 #endif
 
@@ -181,7 +185,7 @@ IOFileObject* fo;
 
   if ((count = 
          (
-#ifdef HAVE_WINSOCK_H
+#ifdef USE_WINSOCK
           fo->flags & FILEOBJ_WINSOCK ?
           recv(fo->fd, p, len, 0) :
           read(fo->fd, p, len))) <= 0 ) {
index e6234ee..d613779 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: filePutc.c,v 1.5 1999/05/05 10:33:15 sof Exp $
+ * $Id: filePutc.c,v 1.6 1999/07/03 18:45:04 sof Exp $
  *
  * hPutChar Runtime Support
  */
 #include "stgio.h"
 #include "error.h"
 
-#ifdef HAVE_WINSOCK_H
+#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
+#define USE_WINSOCK
+#endif
+
+#ifdef USE_WINSOCK
 #include <winsock.h>
 #endif
 
@@ -79,7 +83,7 @@ StgChar c;
 
     /* Unbuffered, write the character directly. */
     while ((rc = (
-#ifdef HAVE_WINSOCK_H
+#ifdef USE_WINSOCK
                 fo->flags & FILEOBJ_WINSOCK ?
                 send(fo->fd, &c, 1, 0) :
                 write(fo->fd, &c, 1))) == 0 && errno == EINTR) ;
index b54e480..0c789be 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: freeFile.c,v 1.4 1999/05/05 10:33:15 sof Exp $
+ * $Id: freeFile.c,v 1.5 1999/07/03 18:45:04 sof Exp $
  *
  * Giving up files
  */
 #include "stgio.h"
 #include "fileObject.h"
 
-#ifdef HAVE_WINSOCK_H
+#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
+#define USE_WINSOCK
+#endif
+
+#ifdef USE_WINSOCK
 #include <winsock.h>
 #endif
 
@@ -68,10 +72,10 @@ StgForeignPtr ptr;
        flushFile(ptr);
     }
 
+#ifdef USE_WINSOCK
     if ( fo->flags & FILEOBJ_WINSOCK )
       /* Sigh - the cleanup call at the end will do this for us */
       return;
-#ifdef HAVE_WINSOCK_H
     rc = ( fo->flags & FILEOBJ_WINSOCK ? closesocket(fo->fd) : close(fo->fd) );
 #else
     rc = close(fo->fd);
index 8956e98..a848439 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: readFile.c,v 1.5 1999/07/01 13:12:09 simonmar Exp $
+ * $Id: readFile.c,v 1.6 1999/07/03 18:45:04 sof Exp $
  *
  * hGetContents Runtime Support
  */
@@ -9,7 +9,11 @@
 #include "Rts.h"
 #include "stgio.h"
 
-#ifdef HAVE_WINSOCK_H
+#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
+#define USE_WINSOCK
+#endif
+
+#ifdef USE_WINSOCK
 #include <winsock.h>
 #endif
 
@@ -78,7 +82,7 @@ StgForeignPtr ptr;
 
     while ((count =
             (
-#ifdef HAVE_WINSOCK_H
+#ifdef USE_WINSOCK
               fo->flags & FILEOBJ_WINSOCK ?
                 recv(fd, fo->buf, fo->bufSize, 0) :
                 read(fd, fo->buf, fo->bufSize))) <= 0 ) {
@@ -171,7 +175,7 @@ StgInt len;
 
     while ((count =
              (
-#ifdef HAVE_WINSOCK_H
+#ifdef USE_WINSOCK
               fo->flags & FILEOBJ_WINSOCK ?
                 recv(fd, p, len, 0) :
                 read(fd, p, len))) <= 0 ) {
@@ -318,7 +322,7 @@ StgForeignPtr ptr;
 
     while ( (count = 
               (
-#ifdef HAVE_WINSOCK_H
+#ifdef USE_WINSOCK
                 fo->flags & FILEOBJ_WINSOCK ?
                 recv(fo->fd, &c, 1, 0) :
                 read(fo->fd, &c, 1))) <= 0 ) {
index ade2249..194c1dd 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: writeFile.c,v 1.4 1999/05/05 10:33:17 sof Exp $
+ * $Id: writeFile.c,v 1.5 1999/07/03 18:45:04 sof Exp $
  *
  * hPutStr Runtime Support
  */
@@ -9,7 +9,11 @@
 #include "Rts.h"
 #include "stgio.h"
 
-#ifdef HAVE_WINSOCK_H
+#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
+#define USE_WINSOCK
+#endif
+
+#ifdef USE_WINSOCK
 #include <winsock.h>
 #endif
 
@@ -54,7 +58,7 @@ StgInt bytes;
 
     while ((count = 
               (
-#ifdef HAVE_WINSOCK_H
+#ifdef USE_WINSOCK
                 fo->flags & FILEOBJ_WINSOCK ?
                 send(fo->fd, fo->buf, bytes, 0) :
                 write(fo->fd, fo->buf, bytes))) < bytes) {
@@ -123,7 +127,7 @@ StgInt  len;
     /* Disallow short writes */
     while ((count = 
                (
-#ifdef HAVE_WINSOCK_H
+#ifdef USE_WINSOCK
                 fo->flags & FILEOBJ_WINSOCK ?
                 send(fo->fd,  (char*)buf, (int)len, 0) :
                 write(fo->fd, (char*)buf, (int)len))) < len ) {