/*
* (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
*/
#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
/* 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 ) {
/*
* (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
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 ) {
/*
* (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
/* 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) ;
/*
* (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
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);
/*
* (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
*/
#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
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 ) {
while ((count =
(
-#ifdef HAVE_WINSOCK_H
+#ifdef USE_WINSOCK
fo->flags & FILEOBJ_WINSOCK ?
recv(fd, p, len, 0) :
read(fd, p, len))) <= 0 ) {
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 ) {
/*
* (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
*/
#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
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) {
/* 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 ) {