Re: [PHP4BETA] cvs: php4 /ext/ftp/ ftp.c ftp.h php_ftp.c

[email protected] (Andi Gutmans)
Newsgroups php.version4
Message-ID <[email protected]>
Frank,

It should use #ifdef/#ifndef PHP_WIN32 and not #if PHP_WIN32.

Andi

On Tue, 23 May 2000, Frank M. Kromann wrote:

> fmk		Tue May 23 10:05:23 2000 EDT
> 
>   Modified files:
>     /php4/ext/ftp	ftp.c ftp.h php_ftp.c 
>   Log:
>   making ftp module compile and work on win32
>   
> Index: php4/ext/ftp/ftp.c
> diff -u php4/ext/ftp/ftp.c:1.17 php4/ext/ftp/ftp.c:1.18
> --- php4/ext/ftp/ftp.c:1.17	Mon May 22 23:16:58 2000
> +++ php4/ext/ftp/ftp.c	Tue May 23 10:05:22 2000
> @@ -28,7 +28,7 @@
>     +----------------------------------------------------------------------+
>   */
>  
> -/* $Id: ftp.c,v 1.17 2000/05/22 21:16:58 askalski Exp $ */
> +/* $Id: ftp.c,v 1.18 2000/05/23 08:05:22 fmk Exp $ */
>  
>  #include "php.h"
>  
> @@ -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 @@
>  		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 @@
>  	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 @@
>  
>  int
>  my_connect(int s, const struct sockaddr *addr, int addrlen)
> +#if !PHP_WIN32
>  {
>  	fd_set		conn_set;
>  	int		flags;
> @@ -921,7 +932,11 @@
>  
>  	return 0;
>  }
> -
> +#else
> +{
> +	return connect(s, addr, addrlen);
> +}
> +#endif
>  
>  int
>  my_accept(int s, struct sockaddr *addr, int *addrlen)
> @@ -938,7 +953,9 @@
>  	n = select(s + 1, &accept_set, NULL, NULL, &tv);
>  	if (n < 1) {
>  		if (n == 0)
> +#if !PHP_WIN32
>  			errno = ETIMEDOUT;
> +#endif
>  		return -1;
>  	}
>  
> Index: php4/ext/ftp/ftp.h
> diff -u php4/ext/ftp/ftp.h:1.9 php4/ext/ftp/ftp.h:1.10
> --- php4/ext/ftp/ftp.h:1.9	Tue Feb 22 21:50:00 2000
> +++ php4/ext/ftp/ftp.h	Tue May 23 10:05:22 2000
> @@ -28,14 +28,15 @@
>     +----------------------------------------------------------------------+
>   */
>  
> -/* $Id: ftp.h,v 1.9 2000/02/22 20:50:00 askalski Exp $ */
> +/* $Id: ftp.h,v 1.10 2000/05/23 08:05:22 fmk Exp $ */
>  
>  #ifndef	_FTP_H
>  #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
> Index: php4/ext/ftp/php_ftp.c
> diff -u php4/ext/ftp/php_ftp.c:1.20 php4/ext/ftp/php_ftp.c:1.21
> --- php4/ext/ftp/php_ftp.c:1.20	Mon May 22 23:16:58 2000
> +++ php4/ext/ftp/php_ftp.c	Tue May 23 10:05:22 2000
> @@ -1,3 +1,4 @@
> +
>  /*
>     +----------------------------------------------------------------------+
>     | PHP HTML Embedded Scripting Language Version 3.0                     |
> @@ -28,7 +29,7 @@
>     +----------------------------------------------------------------------+
>   */
>  
> -/* $Id: php_ftp.c,v 1.20 2000/05/22 21:16:58 askalski Exp $ */
> +/* $Id: php_ftp.c,v 1.21 2000/05/23 08:05:22 fmk Exp $ */
>  
>  #include "php.h"
>  
> 
> 
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.