[PHP-DEV] cvs: /php3/functions ftp.c ftp.h php_ftp.c php_ftp.h From: Frank M. Kromann (fmk <email protected>)
Date: 01/09/00

fmk Sun Jan 9 03:06:01 2000 EDT

  Modified files:
    /php3/functions ftp.c ftp.h php_ftp.c php_ftp.h
  Log:
  Making new ftp-module compile under win32
  
Index: php3/functions/ftp.c
diff -u php3/functions/ftp.c:1.13 php3/functions/ftp.c:1.14
--- php3/functions/ftp.c:1.13 Fri Dec 31 20:31:15 1999
+++ php3/functions/ftp.c Sun Jan 9 03:06:00 2000
@@ -28,7 +28,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ftp.c,v 1.13 2000/01/01 04:31:15 sas Exp $ */
+/* $Id: ftp.c,v 1.14 2000/01/09 11:06:00 fmk Exp $ */
 
 #include "php.h"
 
@@ -37,13 +37,17 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <stdlib.h>
+#ifdef WIN32
+#include "win32/unistd.h"
+#else
 #include <unistd.h>
+#endif
 #include <fcntl.h>
 #include <string.h>
 #include <time.h>
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
+#endif
 #include <errno.h>
 
 #ifdef HAVE_SYS_TIME_H
@@ -107,7 +111,6 @@
         struct hostent *he;
         int size;
 
-
         /* set up the address */
         if ((he = gethostbyname(host)) == NULL) {
 #if 0
@@ -817,7 +820,9 @@
                 n = select(s + 1, NULL, &write_set, NULL, &tv);
                 if (n < 1) {
                         if (n == 0)
+#if !(WIN32|WINNT)
                                 errno = ETIMEDOUT;
+#endif
                         return -1;
                 }
 
@@ -848,7 +853,9 @@
         n = select(s + 1, &read_set, NULL, NULL, &tv);
         if (n < 1) {
                 if (n == 0)
+#if !(WIN32|WINNT)
                         errno = ETIMEDOUT;
+#endif
                 return -1;
         }
 
@@ -858,6 +865,7 @@
 
 int
 my_connect(int s, const struct sockaddr *addr, int addrlen)
+#if !defined(WIN32)
 {
         fd_set conn_set;
         int flags;
@@ -901,6 +909,11 @@
 
         return 0;
 }
+#else
+{
+ return connect(s, addr, addrlen);
+}
+#endif
 
 
 int
@@ -918,7 +931,9 @@
         n = select(s + 1, &accept_set, NULL, NULL, &tv);
         if (n < 1) {
                 if (n == 0)
+#if !(WIN32|WINNT)
                         errno = ETIMEDOUT;
+#endif
                 return -1;
         }
 
Index: php3/functions/ftp.h
diff -u php3/functions/ftp.h:1.8 php3/functions/ftp.h:1.9
--- php3/functions/ftp.h:1.8 Fri Dec 31 20:44:09 1999
+++ php3/functions/ftp.h Sun Jan 9 03:06:00 2000
@@ -28,13 +28,19 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ftp.h,v 1.8 2000/01/01 04:44:09 sas Exp $ */
+/* $Id: ftp.h,v 1.9 2000/01/09 11:06:00 fmk Exp $ */
 
 #ifndef _FTP_H
 #define _FTP_H
 
 #include <stdio.h>
+#ifdef WIN32
+#include <winsock.h>
+#include "win32/include/portability.h"
+#else
 #include <netinet/in.h>
+#include <netdb.h>
+#endif
 
 
 /* XXX these should be configurable at runtime XXX */
Index: php3/functions/php_ftp.c
diff -u php3/functions/php_ftp.c:1.7 php3/functions/php_ftp.c:1.8
--- php3/functions/php_ftp.c:1.7 Fri Dec 31 20:31:16 1999
+++ php3/functions/php_ftp.c Sun Jan 9 03:06:00 2000
@@ -28,7 +28,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_ftp.c,v 1.7 2000/01/01 04:31:16 sas Exp $ */
+/* $Id: php_ftp.c,v 1.8 2000/01/09 11:06:00 fmk Exp $ */
 
 #include "php.h"
 
@@ -84,6 +84,10 @@
         NULL,
         STANDARD_MODULE_PROPERTIES
 };
+
+#if COMPILE_DL
+DLEXPORT php3_module_entry *get_module(void) { return &php3_ftp_module_entry; }
+#endif
 
 static void ftp_destructor_ftpbuf(ftpbuf_t *ftp)
 {
Index: php3/functions/php_ftp.h
diff -u php3/functions/php_ftp.h:1.6 php3/functions/php_ftp.h:1.7
--- php3/functions/php_ftp.h:1.6 Fri Dec 31 20:44:10 1999
+++ php3/functions/php_ftp.h Sun Jan 9 03:06:00 2000
@@ -28,12 +28,13 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_ftp.h,v 1.6 2000/01/01 04:44:10 sas Exp $ */
+/* $Id: php_ftp.h,v 1.7 2000/01/09 11:06:00 fmk Exp $ */
 
 #ifndef _INCLUDED_FTP_H
 #define _INCLUDED_FTP_H
 
 #if COMPILE_DL
+#include "dl/phpdl.h"
 #undef HAVE_FTP
 #define HAVE_FTP 1
 #endif

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>