summaryrefslogtreecommitdiff
path: root/ext/ftp
diff options
context:
space:
mode:
authorFrank M. Kromann <fmk@php.net>2000-05-23 08:05:22 +0000
committerFrank M. Kromann <fmk@php.net>2000-05-23 08:05:22 +0000
commit08bd9586fb0085a7796d698a66953e968a63520f (patch)
tree8eface709e7d5bd9fc933ac6749c2bb99b98e35c /ext/ftp
parent61ceb9e5abfd6e57ebc2022c6c789040adc9b9e6 (diff)
downloadphp-git-08bd9586fb0085a7796d698a66953e968a63520f.tar.gz
making ftp module compile and work on win32
Diffstat (limited to 'ext/ftp')
-rw-r--r--ext/ftp/ftp.c21
-rw-r--r--ext/ftp/ftp.h3
-rw-r--r--ext/ftp/php_ftp.c1
3 files changed, 22 insertions, 3 deletions
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index fa167a62d8..1b0eefa039 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -37,13 +37,19 @@
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
+#if HAVE_UINSTD_H
#include <unistd.h>
+#endif
#include <fcntl.h>
#include <string.h>
#include <time.h>
+#if PHP_WIN32
+#include <winsock.h>
+#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
+#endif
#include <errno.h>
#if HAVE_SYS_TIME_H
@@ -53,7 +59,7 @@
#include "ftp.h"
/* define closesocket macro for portability */
-#if !defined(WIN32) && !defined(WINNT)
+#if !PHP_WIN32
#undef closesocket
#define closesocket close
#endif
@@ -837,7 +843,9 @@ my_send(int s, void *buf, size_t len)
n = select(s + 1, NULL, &write_set, NULL, &tv);
if (n < 1) {
if (n == 0)
+#if !PHP_WIN32
errno = ETIMEDOUT;
+#endif
return -1;
}
@@ -868,7 +876,9 @@ my_recv(int s, void *buf, size_t len)
n = select(s + 1, &read_set, NULL, NULL, &tv);
if (n < 1) {
if (n == 0)
+#if !PHP_WIN32
errno = ETIMEDOUT;
+#endif
return -1;
}
@@ -878,6 +888,7 @@ my_recv(int s, void *buf, size_t len)
int
my_connect(int s, const struct sockaddr *addr, int addrlen)
+#if !PHP_WIN32
{
fd_set conn_set;
int flags;
@@ -921,7 +932,11 @@ my_connect(int s, const struct sockaddr *addr, int addrlen)
return 0;
}
-
+#else
+{
+ return connect(s, addr, addrlen);
+}
+#endif
int
my_accept(int s, struct sockaddr *addr, int *addrlen)
@@ -938,7 +953,9 @@ my_accept(int s, struct sockaddr *addr, int *addrlen)
n = select(s + 1, &accept_set, NULL, NULL, &tv);
if (n < 1) {
if (n == 0)
+#if !PHP_WIN32
errno = ETIMEDOUT;
+#endif
return -1;
}
diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h
index 562c2dbfea..7abf6c0aac 100644
--- a/ext/ftp/ftp.h
+++ b/ext/ftp/ftp.h
@@ -34,8 +34,9 @@
#define _FTP_H
#include <stdio.h>
+#if HAVE_UINSTD_H
#include <netinet/in.h>
-
+#endif
/* XXX these should be configurable at runtime XXX */
#define FTP_BUFSIZE 4096
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
index e76f3c7096..9770679430 100644
--- a/ext/ftp/php_ftp.c
+++ b/ext/ftp/php_ftp.c
@@ -1,3 +1,4 @@
+
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |