[PHP-DEV] CVS update: php3/functions From: sas (php-dev <email protected>)
Date: 02/27/99

Date: Saturday February 27, 1999 @ 12:04
Author: sas

Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv13746/functions

Modified Files:
        fsock.c
Log Message:
moved inet_aton to compat "library"
Index: php3/functions/fsock.c
diff -c php3/functions/fsock.c:1.84 php3/functions/fsock.c:1.85
*** php3/functions/fsock.c:1.84 Fri Jan 29 17:38:22 1999
--- php3/functions/fsock.c Sat Feb 27 12:04:46 1999
***************
*** 27,33 ****
     | Jim Winstead (jimw <email protected>) |
     +----------------------------------------------------------------------+
  */
! /* $Id: fsock.c,v 1.84 1999/01/29 22:38:22 rasmus Exp $ */
  #ifdef THREAD_SAFE
  #include "tls.h"
  #endif
--- 27,33 ----
     | Jim Winstead (jimw <email protected>) |
     +----------------------------------------------------------------------+
  */
! /* $Id: fsock.c,v 1.85 1999/02/27 17:04:46 sas Exp $ */
  #ifdef THREAD_SAFE
  #include "tls.h"
  #endif
***************
*** 100,171 ****
  
          /* {{{ lookup_hostname */
  
- #if !(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.
   */
--- 100,105 ----

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>