CVS update: php3/functions

From: Date: Fri, 29 Jan 1999 21:42:15 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-3778@lists.php.net to get a copy of this message
Date: Friday January 29, 1999 @ 16:42 Author: shane Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv9532/functions Modified Files: fsock.c unified_odbc.c Log Message: add inet_aton for systems that don't have it. Someone needs to do config stuff on unix for this. Index: php3/functions/fsock.c diff -c php3/functions/fsock.c:1.81 php3/functions/fsock.c:1.82 *** php3/functions/fsock.c:1.81 Sun Jan 24 19:02:27 1999 --- php3/functions/fsock.c Fri Jan 29 16:42:15 1999 *************** *** 27,33 **** | Jim Winstead (jimw@php.net) | +----------------------------------------------------------------------+ */ ! /* $Id: fsock.c,v 1.81 1999/01/25 00:02:27 sas Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif --- 27,33 ---- | Jim Winstead (jimw@php.net) | +----------------------------------------------------------------------+ */ ! /* $Id: fsock.c,v 1.82 1999/01/29 21:42:15 shane Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif *************** *** 43,56 **** #if HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif ! #if MSVC5 #include <winsock.h> #else #include <netinet/in.h> #include <netdb.h> #include <arpa/inet.h> #endif ! #if MSVC5 #undef AF_UNIX #endif #if defined(AF_UNIX) --- 43,56 ---- #if HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif ! #ifdef WIN32 #include <winsock.h> #else #include <netinet/in.h> #include <netdb.h> #include <arpa/inet.h> #endif ! #ifdef WIN32 #undef AF_UNIX #endif #if defined(AF_UNIX) *************** *** 100,105 **** --- 100,180 ---- /* {{{ lookup_hostname */ + /* FIXME Should check with windows before making perm changes ;) + * vc 6 doesn not have inet_aton, so we have to add it ourselves + */ + + /* FIXME, add HAVE_INET_ATON to config for unix systems */ + #ifndef WIN32 + #define HAVE_INET_ATON + #endif + + #ifndef HAVE_INET_ATON + + /* + * Check whether "cp" is a valid ascii representation + * of an Internet address and convert to a binary address. + * Returns 1 if the address is valid, 0 if not. + * This replaces inet_addr, the return value from which + * cannot distinguish between failure and a local broadcast address. + */ + + int + inet_aton(const char *cp, struct in_addr *ap) + { + int dots = 0; + register u_long acc = 0, addr = 0; + + do { + register char cc = *cp; + + switch (cc) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + acc = acc * 10 + (cc - '0'); + break; + + case '.': + if (++dots > 3) { + return 0; + } + /* Fall through */ + + case '\0': + if (acc > 255) { + return 0; + } + addr = addr << 8 | acc; + acc = 0; + break; + + default: + return 0; + } + } while (*cp++) ; + + /* Normalize the address */ + if (dots < 3) { + addr <<= 8 * (3 - dots) ; + } + + /* Store it if requested */ + if (ap) { + ap->s_addr = htonl(addr); + } + + return 1; + } + + #endif /* * Converts a host name to an IP address. */ Index: php3/functions/unified_odbc.c diff -c php3/functions/unified_odbc.c:1.99 php3/functions/unified_odbc.c:1.100 *** php3/functions/unified_odbc.c:1.99 Sun Jan 3 11:20:45 1999 --- php3/functions/unified_odbc.c Fri Jan 29 16:42:15 1999 *************** *** 29,35 **** +----------------------------------------------------------------------+ */ ! /* $Id: unified_odbc.c,v 1.99 1999/01/03 16:20:45 rasmus Exp $ */ /* This file is based on the Adabas D extension. * Adabas D will no longer be supported as separate module. --- 29,35 ---- +----------------------------------------------------------------------+ */ ! /* $Id: unified_odbc.c,v 1.100 1999/01/29 21:42:15 shane Exp $ */ /* This file is based on the Adabas D extension. * Adabas D will no longer be supported as separate module. *************** *** 413,419 **** php3_printf("Unified ODBC Support active (compiled with unknown library)"); #endif php3_printf("<BR>"); ! #if DEBUG php3_printf("default_db: %s<br>\n",UODBC_GLOBAL(PHP3_UODBC_MODULE).defDB); php3_printf("default_user: %s<br>\n",UODBC_GLOBAL(PHP3_UODBC_MODULE).defUser); php3_printf("default_pw: %s<br>\n",UODBC_GLOBAL(PHP3_UODBC_MODULE).defPW); --- 413,419 ---- php3_printf("Unified ODBC Support active (compiled with unknown library)"); #endif php3_printf("<BR>"); ! #if 0 && DEBUG php3_printf("default_db: %s<br>\n",UODBC_GLOBAL(PHP3_UODBC_MODULE).defDB); php3_printf("default_user: %s<br>\n",UODBC_GLOBAL(PHP3_UODBC_MODULE).defUser); php3_printf("default_pw: %s<br>\n",UODBC_GLOBAL(PHP3_UODBC_MODULE).defPW); -- 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

« previous php.dev (#3778) next »