[project @ 1999-09-19 19:26:14 by sof]
[ghc-hetmet.git] / ghc / lib / std / cbits / fileObject.c
index badb5c7..b8b009d 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.6 1999/09/16 13:14:42 simonmar Exp $
  *
  * hPutStr Runtime Support
  */
 
 #include <stdio.h>
 
-#ifdef HAVE_WINSOCK_H
+#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+#define USE_WINSOCK
+#endif
+
+#ifdef USE_WINSOCK
 #include <winsock.h>
 #endif
 
@@ -132,32 +136,6 @@ StgInt
 getPushbackBufSize()
 { return (__pushback_buf_size__); }
 
-void
-clearNonBlockingIOFlag__ (ptr)
-StgForeignPtr ptr;
-{ ((IOFileObject*)ptr)->flags &= ~FILEOBJ_NONBLOCKING_IO; }
-
-void
-setNonBlockingIOFlag__ (ptr)
-StgForeignPtr ptr;
-{ ((IOFileObject*)ptr)->flags |= FILEOBJ_NONBLOCKING_IO; }
-
-void
-clearConnNonBlockingIOFlag__ (ptr)
-StgForeignPtr ptr;
-{ ((IOFileObject*)ptr)->connectedTo->flags &= ~FILEOBJ_NONBLOCKING_IO; }
-
-void
-setConnNonBlockingIOFlag__ (ptr)
-StgForeignPtr ptr;
-{ 
-  if ( ((IOFileObject*)ptr)->connectedTo != NULL )  {
-    ((IOFileObject*)ptr)->connectedTo->flags |= FILEOBJ_NONBLOCKING_IO;
-  }
-  return;
-}
-
-
 /* Only ever called on line-buffered file objects */
 StgInt
 fill_up_line_buffer(fo)
@@ -176,12 +154,9 @@ IOFileObject* fo;
   len = fo->bufSize - fo->bufWPtr + 1;
   p   = (unsigned char*)fo->buf + fo->bufWPtr;
 
-  if ( fo->flags & FILEOBJ_NONBLOCKING_IO && inputReady ((StgForeignPtr)fo,0) != 1 )
-     return FILEOBJ_BLOCKED_READ;
-
   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 ) {