CVS update: php3/functions
| From: | shane | Date: | Tue, 15 Sep 1998 23:40:04 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-1153@lists.php.net to get a copy of this message | ||
Date: Tuesday September 15, 1998 @ 19:40
Author: shane
Update of /repository/php3/functions
In directory asf:/u2/tmp/cvs-serv9601/functions
Modified Files:
hg_comm.c hw.c hw.h
Log Message:
hyperwave now compiles in msvc. no idea if it works or how to test it.
Index: php3/functions/hg_comm.c
diff -c php3/functions/hg_comm.c:1.5 php3/functions/hg_comm.c:1.6
*** php3/functions/hg_comm.c:1.5 Fri Aug 28 07:15:12 1998
--- php3/functions/hg_comm.c Tue Sep 15 19:40:02 1998
***************
*** 23,29 ****
+----------------------------------------------------------------------+
*/
! /* $Id: hg_comm.c,v 1.5 1998/08/28 11:15:12 steinm Exp $ */
/* #define HW_DEBUG */
--- 23,29 ----
+----------------------------------------------------------------------+
*/
! /* $Id: hg_comm.c,v 1.6 1998/09/15 23:40:02 shane Exp $ */
/* #define HW_DEBUG */
***************
*** 41,47 ****
#include <string.h>
#include <sys/types.h>
#if WIN32|WINNT
! # include <winsock.h>
#else
# include <sys/socket.h>
# include <netinet/in.h>
--- 41,51 ----
#include <string.h>
#include <sys/types.h>
#if WIN32|WINNT
! # include <winsock2.h>
! # define EWOULDBLOCK WSAEWOULDBLOCK
! # define ETIMEDOUT WSAETIMEDOUT
! # define bcopy memcpy
! # define bzero(a,b) memset(a,0,b)
#else
# include <sys/socket.h>
# include <netinet/in.h>
***************
*** 104,110 ****
if((str == NULL) || (insstr == NULL))
return NULL;
! if(pos > strlen(str))
return NULL;
if(insstr[0] == '\0')
--- 108,114 ----
if((str == NULL) || (insstr == NULL))
return NULL;
! if(pos > (int)strlen(str))
return NULL;
if(insstr[0] == '\0')
***************
*** 670,676 ****
/*
** Make sure that address may be reused
*/
! #ifdef SUN
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&option, sizeof(option));
#else
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option));
--- 674,680 ----
/*
** Make sure that address may be reused
*/
! #if defined(SUN) || (WIN32|WINNT)
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&option, sizeof(option));
#else
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option));
***************
*** 727,736 ****
--- 731,747 ----
#include <errno.h>
#include <signal.h>
+ #if !(WIN32|WINNT)
static sigset_t newmask, oldmask, zeromask;
+ #endif
static int set_noblock(int fd)
{
+ #if WIN32|WINNT
+ u_long argp=1;
+
+ return ioctlsocket (fd, FIONBIO , &argp);
+ #else
sigemptyset(&zeromask);
sigemptyset(&newmask);
***************
*** 740,745 ****
--- 751,757 ----
if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0) return -1;
return fcntl(fd, F_SETFL, O_NONBLOCK | O_NDELAY /* | FNBIO*/);
+ #endif
}
int write_to(int fd, void *buffer, int n, int timeout)
***************
*** 747,753 ****
int nrem, nw;
char *bptr;
int error;
! #ifdef SYSV
int width = 20;
#else
int width = getdtablesize();
--- 759,765 ----
int nrem, nw;
char *bptr;
int error;
! #if defined(SYSV) || (WIN32|WINNT)
int width = 20;
#else
int width = getdtablesize();
***************
*** 756,762 ****
--- 768,778 ----
struct timeval select_timeout;
select_timeout.tv_sec = timeout;
+ #if WIN32|WINNT
+ select_timeout.tv_usec = 0;
+ #else /* is this just a typo? */
select_timeout.tv_usec = 0.;
+ #endif
/* Set fd to non-blocking */
***************
*** 766,772 ****
FD_ZERO(&writefds);
! FD_SET(fd, &writefds);
for( nrem = n, bptr = buffer; nrem;)
{
--- 782,788 ----
FD_ZERO(&writefds);
! FD_SET((unsigned int)fd, &writefds);
for( nrem = n, bptr = buffer; nrem;)
{
***************
*** 795,801 ****
--- 811,819 ----
bptr += nw;
}
}
+ #if !(WIN32|WINNT)
if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) return -1;
+ #endif
if( ! error ) {
errno = ETIMEDOUT;
return(-2);
***************
*** 812,827 ****
char *bptr;
int error;
! #ifdef SYSV
int width = 20;
#else
int width = getdtablesize();
! #endif SYSV
fd_set readfds;
struct timeval select_timeout;
select_timeout.tv_sec = timeout;
select_timeout.tv_usec = 0.;
/* Set fd to non-blocking */
--- 830,849 ----
char *bptr;
int error;
! #if defined(SYSV) || (WIN32|WINNT)
int width = 20;
#else
int width = getdtablesize();
! #endif
fd_set readfds;
struct timeval select_timeout;
select_timeout.tv_sec = timeout;
+ #if WIN32|WINNT
+ select_timeout.tv_usec = 0;
+ #else
select_timeout.tv_usec = 0.;
+ #endif
/* Set fd to non-blocking */
***************
*** 829,835 ****
FD_ZERO(&readfds);
! FD_SET(fd, &readfds);
for( nrem = n, bptr = buffer, nread = 0; nrem;)
{
--- 851,857 ----
FD_ZERO(&readfds);
! FD_SET((unsigned int)fd, &readfds);
for( nrem = n, bptr = buffer, nread = 0; nrem;)
{
***************
*** 867,873 ****
--- 889,897 ----
}
}
+ #if !(WIN32|WINNT)
if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) return -1;
+ #endif
if( ! error )
{
errno = ETIMEDOUT;
***************
*** 916,922 ****
return(-1);
}
! #ifdef SUN
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&option, sizeof(option));
#else
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option));
--- 940,946 ----
return(-1);
}
! #if defined(SUN) || (WIN32|WINNT)
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&option, sizeof(option));
#else
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option));
***************
*** 928,935 ****
--- 952,961 ----
return(-1);
}
+ #if !(WIN32|WINNT)
if ( (sock_flags = fcntl(sockfd, F_GETFL, 0)) == -1 )
/* php3_error(E_WARNING, "open_hg_connection: F_GETFL"); */
+ #endif
if ( set_nonblocking(sockfd) == -1 ) {
return(-1);
***************
*** 1044,1053 ****
--- 1070,1088 ----
static int set_nonblocking(int fd)
{
+ #if WIN32|WINNT
+ unsigned int argp=0;
+
+ /* if ( sock_flags == -1 )
+ getsockopt (fd, SOL_SOCKET, optname, optval, optlen);
+ */ if(ioctlsocket (fd, FIONBIO , &argp) == -1)
+ return(-1);
+ #else
if ( sock_flags == -1 )
sock_flags = fcntl(fd, F_GETFL, 0);
if ( fcntl(fd, F_SETFL, O_NONBLOCK) == -1 )
return(-1);
+ #endif
non_blocking = 1;
return(0);
}
***************
*** 1055,1062 ****
--- 1090,1104 ----
static int set_blocking(int fd)
{
+ #if WIN32|WINNT
+ unsigned int argp=1;
+
+ if(ioctlsocket (fd, FIONBIO , &argp) == -1)
+ return(-1);
+ #else
if ( fcntl(fd, F_SETFL, sock_flags) == -1 )
return(-1);
+ #endif
return(0);
}
***************
*** 1688,1693 ****
--- 1730,1738 ----
return 0;
}
+ int send_getdestforanchorsobj(int sockfd, char **anchorrec, char ***destrec, int count);
+ int send_getreldestforanchorsobj(int sockfd, char **anchorrec, char ***reldestrec, int count, int
rootID, int thisID);
+
int send_gettext(int sockfd, hw_objectID objectID, int mode, int rootid, char **objattr, char
**bodytag, char **text, int *count)
{
hg_msg msg, *retmsg;
***************
*** 1854,1860 ****
efree(msg.buf);
retmsg = recv_hg_msg(sockfd);
if (retmsg == NULL) {
! *text = NULL;
return(-1);
}
--- 1899,1905 ----
efree(msg.buf);
retmsg = recv_hg_msg(sockfd);
if (retmsg == NULL) {
! *text = '\0';
return(-1);
}
***************
*** 4029,4035 ****
if(send_getanchorsobj(sockfd, objectID, &anchors, &ancount) == 0) {
char **destrec, **reldestrec;
DLIST *pAnchorList = NULL;
- int i;
send_getdestforanchorsobj(sockfd, anchors, &destrec, ancount);
send_getreldestforanchorsobj(sockfd, anchors, &reldestrec, ancount, rootid, objectID);
--- 4074,4079 ----
***************
*** 4266,4276 ****
if(host) {
if((hostptr = gethostbyname(host)) == NULL) {
php3_error(E_WARNING, "gethostbyname failed for %s", host);
! close(fd);
return(-1);
}
} else {
! close(fd);
return(-1);
}
--- 4310,4320 ----
if(host) {
if((hostptr = gethostbyname(host)) == NULL) {
php3_error(E_WARNING, "gethostbyname failed for %s", host);
! /* close(fd); fd is not set yet */
return(-1);
}
} else {
! /* close(fd); fd is not set yet */
return(-1);
}
Index: php3/functions/hw.c
diff -c php3/functions/hw.c:1.9 php3/functions/hw.c:1.10
*** php3/functions/hw.c:1.9 Thu Sep 10 19:57:18 1998
--- php3/functions/hw.c Tue Sep 15 19:40:03 1998
***************
*** 23,29 ****
+----------------------------------------------------------------------+
*/
! /* $Id: hw.c,v 1.9 1998/09/10 23:57:18 zeev Exp $ */
#if COMPILE_DL
#include "dl/phpdl.h"
#endif
--- 23,29 ----
+----------------------------------------------------------------------+
*/
! /* $Id: hw.c,v 1.10 1998/09/15 23:40:03 shane Exp $ */
#if COMPILE_DL
#include "dl/phpdl.h"
#endif
***************
*** 1508,1517 ****
--- 1508,1524 ----
string. It should contain any enviroment variable a cgi script
requires.
*/
+ #if (WIN32|WINNT)
sprintf(cgi_env_str, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
+ getenv("REQUEST_METHOD"),
+ getenv("PATH_INFO"),
+ getenv("QUERY_STRING"));
+ #else
+ sprintf(cgi_env_str, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
GLOBAL(request_info).request_method,
GLOBAL(request_info).path_info,
GLOBAL(request_info).query_string);
+ #endif
/* !!!! memory for object and attributes is allocated with malloc !!!! */
if (0 != (ptr->lasterror = send_getcgi(ptr->socket, id, cgi_env_str, &attributes,
&object, &count)))
RETURN_FALSE;
***************
*** 1738,1747 ****
--- 1745,1761 ----
char *attributes = NULL;
int count;
+ #if (WIN32|WINNT)
sprintf(cgi_env_str, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
+ getenv("REQUEST_METHOD"),
+ getenv("PATH_INFO"),
+ getenv("QUERY_STRING"));
+ #else
+ sprintf(cgi_env_str, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
GLOBAL(request_info).request_method,
GLOBAL(request_info).path_info,
GLOBAL(request_info).query_string);
+ #endif
/* !!!! memory for object, bodytag and attributes is allocated with malloc !!!! */
if (0 != (ptr->lasterror = send_pipecgi(ptr->socket,
#if APACHE
Index: php3/functions/hw.h
diff -c php3/functions/hw.h:1.2 php3/functions/hw.h:1.3
*** php3/functions/hw.h:1.2 Fri Aug 21 01:30:53 1998
--- php3/functions/hw.h Tue Sep 15 19:40:03 1998
***************
*** 23,29 ****
*/
! /* $Id: hw.h,v 1.2 1998/08/21 05:30:53 steinm Exp $ */
#ifndef _HW_H
#define _HW_H
--- 23,29 ----
*/
! /* $Id: hw.h,v 1.3 1998/09/15 23:40:03 shane Exp $ */
#ifndef _HW_H
#define _HW_H
***************
*** 109,115 ****
extern void php3_hw_objrec2array(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_hw_array2objrec(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_hw_connection_info(INTERNAL_FUNCTION_PARAMETERS);
! extern void php3_info_hw();
extern void php3_hw_getsrcbydestobj(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_hw_getrellink(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_hw_dummy(INTERNAL_FUNCTION_PARAMETERS);
--- 109,115 ----
extern void php3_hw_objrec2array(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_hw_array2objrec(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_hw_connection_info(INTERNAL_FUNCTION_PARAMETERS);
! extern void php3_info_hw(void);
extern void php3_hw_getsrcbydestobj(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_hw_getrellink(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_hw_dummy(INTERNAL_FUNCTION_PARAMETERS);
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net