aboutsummaryrefslogtreecommitdiffstats
path: root/src/assuan-io.c
diff options
context:
space:
mode:
authorTimo Schulz <[email protected]>2004-11-24 07:30:08 +0000
committerTimo Schulz <[email protected]>2004-11-24 07:30:08 +0000
commitc36b96808391edf9211b1c60b00825f31be7a93c (patch)
treea0b446f425c02eea2d44dad2cbf461ff76f9ad11 /src/assuan-io.c
parent* assuan-socket-connect.c (LOG): Fixed macro to print not only the (diff)
downloadlibassuan-c36b96808391edf9211b1c60b00825f31be7a93c.tar.gz
libassuan-c36b96808391edf9211b1c60b00825f31be7a93c.zip
2004-11-23 Timo Schulz <[email protected]>
* assuan-socket.c (_assuan_sock_connect): Get local port from the sun_path[] file. (_assuan_sock_bind): Write local port to the sun_path[] file. * assuan-socket-connect.c (assuan_socket_connect): Use DIRSEP_C for a better portability. (assuan-defs.h): Define DIRSEP_C. 2004-11-22 Timo Schulz <[email protected]> * assuan-io.c (_assuan_simple_read, _assuan_simple_write): W32 support. * assuan-socket.c (_assuan_close): New. (_assuan_sock_new): New. (_assuan_sock_bind): New.
Diffstat (limited to 'src/assuan-io.c')
-rw-r--r--src/assuan-io.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/assuan-io.c b/src/assuan-io.c
index b10571b..aea327a 100644
--- a/src/assuan-io.c
+++ b/src/assuan-io.c
@@ -1,5 +1,5 @@
/* assuan-io.c - Wraps the read and write functions.
- * Copyright (C) 2002 Free Software Foundation, Inc.
+ * Copyright (C) 2002, 2004 Free Software Foundation, Inc.
*
* This file is part of Assuan.
*
@@ -21,6 +21,9 @@
#include "assuan-defs.h"
#include <sys/types.h>
#include <unistd.h>
+#ifdef _WIN32
+#include <windows.h>
+#endif
extern ssize_t pth_read (int fd, void *buffer, size_t size);
extern ssize_t pth_write (int fd, const void *buffer, size_t size);
@@ -29,13 +32,27 @@ extern ssize_t pth_write (int fd, const void *buffer, size_t size);
#pragma weak pth_write
ssize_t
-_assuan_simple_read (ASSUAN_CONTEXT ctx, void *buffer, size_t size)
+_assuan_simple_read (assuan_context_t ctx, void *buffer, size_t size)
{
+ #ifndef _WIN32
return (pth_read ? pth_read : read) (ctx->inbound.fd, buffer, size);
+ #else
+ return pth_read ? pth_read (ctx->inbound.fd, buffer, size)
+ : recv (ctx->inbound.fd, buffer, size, 0);
+ #endif
}
ssize_t
-_assuan_simple_write (ASSUAN_CONTEXT ctx, const void *buffer, size_t size)
+_assuan_simple_write (assuan_context_t ctx, const void *buffer, size_t size)
{
+ #ifndef _WIN32
return (pth_write ? pth_write : write) (ctx->outbound.fd, buffer, size);
+ #else
+ return pth_write ? pth_write (ctx->outbound.fd, buffer, size)
+ : send (ctx->outbound.fd, buffer, size, 0);
+ #endif
}
+
+
+
+