iliaa           Wed Dec 31 14:30:38 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/standard       dns.c dns.h basic_functions.c 
    /php-src    configure.in NEWS 
    /php-src/win32/build        config.w32.h.in 
  Log:
  
  [DOC]
  Added gethostname() to return the current system host name. 
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.70.2.7.2.5.2.9&r2=1.70.2.7.2.5.2.10&diff_format=u
Index: php-src/ext/standard/dns.c
diff -u php-src/ext/standard/dns.c:1.70.2.7.2.5.2.9 
php-src/ext/standard/dns.c:1.70.2.7.2.5.2.10
--- php-src/ext/standard/dns.c:1.70.2.7.2.5.2.9 Wed Dec 31 11:15:44 2008
+++ php-src/ext/standard/dns.c  Wed Dec 31 14:30:37 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dns.c,v 1.70.2.7.2.5.2.9 2008/12/31 11:15:44 sebastian Exp $ */
+/* $Id: dns.c,v 1.70.2.7.2.5.2.10 2008/12/31 14:30:37 iliaa Exp $ */
 
 /* {{{ includes */
 #include "php.h"
@@ -107,6 +107,27 @@
 static char *php_gethostbyaddr(char *ip);
 static char *php_gethostbyname(char *name);
 
+#ifdef HAVE_GETHOSTNAME
+/* {{{ proto string gethostname()
+   Get the host name of the current machine */
+PHP_FUNCTION(gethostname)
+{
+       char buf[4096];
+
+       if (zend_parse_parameters_none() == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       if (gethostname(buf, sizeof(buf) - 1)) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to fetch 
host [%d]: %s", errno, strerror(errno));
+               RETURN_FALSE;
+       }
+
+       RETURN_STRING(buf, 1);
+}
+/* }}} */
+#endif
+
 /* {{{ proto string gethostbyaddr(string ip_address)
    Get the Internet host name corresponding to a given IP address */
 PHP_FUNCTION(gethostbyaddr)
@@ -134,6 +155,7 @@
 }
 /* }}} */
 
+
 /* {{{ php_gethostbyaddr */
 static char *php_gethostbyaddr(char *ip)
 {
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.h?r1=1.19.2.1.2.1.2.2&r2=1.19.2.1.2.1.2.3&diff_format=u
Index: php-src/ext/standard/dns.h
diff -u php-src/ext/standard/dns.h:1.19.2.1.2.1.2.2 
php-src/ext/standard/dns.h:1.19.2.1.2.1.2.3
--- php-src/ext/standard/dns.h:1.19.2.1.2.1.2.2 Wed Dec 31 11:15:45 2008
+++ php-src/ext/standard/dns.h  Wed Dec 31 14:30:37 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: dns.h,v 1.19.2.1.2.1.2.2 2008/12/31 11:15:45 sebastian Exp $ */
+/* $Id: dns.h,v 1.19.2.1.2.1.2.3 2008/12/31 14:30:37 iliaa Exp $ */
 
 #ifndef DNS_H
 #define DNS_H
@@ -31,6 +31,10 @@
 PHP_FUNCTION(gethostbyname);
 PHP_FUNCTION(gethostbynamel);
 
+#ifdef HAVE_GETHOSTNAME
+PHP_FUNCTION(gethostname);
+#endif
+
 #if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32))
 
 PHP_FUNCTION(dns_check_record);
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.64.2.80&r2=1.725.2.31.2.64.2.81&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.80 
php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.81
--- php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.80 Wed Dec 31 
14:27:09 2008
+++ php-src/ext/standard/basic_functions.c      Wed Dec 31 14:30:37 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.80 2008/12/31 14:27:09 helly Exp 
$ */
+/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.81 2008/12/31 14:30:37 iliaa Exp 
$ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -991,6 +991,11 @@
        ZEND_ARG_INFO(0, hostname)
 ZEND_END_ARG_INFO()
 
+#ifdef HAVE_GETHOSTNAME
+ZEND_BEGIN_ARG_INFO(arginfo_gethostname, 0)
+ZEND_END_ARG_INFO()
+#endif
+
 #if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32) || 
defined(NETWARE))
 ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_check_record, 0, 0, 1)
        ZEND_ARG_INFO(0, host)
@@ -2990,6 +2995,10 @@
        PHP_FE(gethostbyname,                                                   
                                                arginfo_gethostbyname)
        PHP_FE(gethostbynamel,                                                  
                                                arginfo_gethostbynamel)
 
+#ifdef HAVE_GETHOSTNAME
+       PHP_FE(gethostname,                                                     
                                                arginfo_gethostname)
+#endif
+
 #if HAVE_RES_SEARCH && !(defined(__BEOS__) || defined(PHP_WIN32) || 
defined(NETWARE))
        PHP_FE(dns_check_record,                                                
                                                arginfo_dns_check_record)
        PHP_FALIAS(checkdnsrr,                  dns_check_record,               
                                arginfo_dns_check_record)
http://cvs.php.net/viewvc.cgi/php-src/configure.in?r1=1.579.2.52.2.77.2.38&r2=1.579.2.52.2.77.2.39&diff_format=u
Index: php-src/configure.in
diff -u php-src/configure.in:1.579.2.52.2.77.2.38 
php-src/configure.in:1.579.2.52.2.77.2.39
--- php-src/configure.in:1.579.2.52.2.77.2.38   Fri Dec 12 23:43:17 2008
+++ php-src/configure.in        Wed Dec 31 14:30:38 2008
@@ -1,4 +1,4 @@
-## $Id: configure.in,v 1.579.2.52.2.77.2.38 2008/12/12 23:43:17 nlopess Exp $ 
-*- autoconf -*-
+## $Id: configure.in,v 1.579.2.52.2.77.2.39 2008/12/31 14:30:38 iliaa Exp $ 
-*- autoconf -*-
 dnl ## Process this file with autoconf to produce a configure script.
 
 divert(1)
@@ -575,6 +575,7 @@
 getprotobynumber \
 getservbyname \
 getservbyport \
+gethostname \
 getrusage \
 gettimeofday \
 gmtime_r \
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.429&r2=1.2027.2.547.2.965.2.430&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.429 
php-src/NEWS:1.2027.2.547.2.965.2.430
--- php-src/NEWS:1.2027.2.547.2.965.2.429       Wed Dec 31 14:27:08 2008
+++ php-src/NEWS        Wed Dec 31 14:30:38 2008
@@ -14,6 +14,7 @@
 
 - Added json_last_error() to return any error information from json_decode().
   (Scott)
+- Added gethostname() to return the current system host name. (Ilia)
 - Added shm_has_var() function. (Mike)
 - Added depth parameter to json_decode() to lower the nesting depth from the
   maximum if required. (Scott)
http://cvs.php.net/viewvc.cgi/php-src/win32/build/config.w32.h.in?r1=1.7.2.4.2.3.2.5&r2=1.7.2.4.2.3.2.6&diff_format=u
Index: php-src/win32/build/config.w32.h.in
diff -u php-src/win32/build/config.w32.h.in:1.7.2.4.2.3.2.5 
php-src/win32/build/config.w32.h.in:1.7.2.4.2.3.2.6
--- php-src/win32/build/config.w32.h.in:1.7.2.4.2.3.2.5 Sat Nov 22 15:16:47 2008
+++ php-src/win32/build/config.w32.h.in Wed Dec 31 14:30:38 2008
@@ -1,6 +1,6 @@
 /*
        Build Configuration Template for Win32.
-       $Id: config.w32.h.in,v 1.7.2.4.2.3.2.5 2008/11/22 15:16:47 scottmac Exp 
$
+       $Id: config.w32.h.in,v 1.7.2.4.2.3.2.6 2008/12/31 14:30:38 iliaa Exp $
 */
 
 /* Define the minimum supported version */
@@ -53,6 +53,7 @@
 /* its in win32/time.c */
 #define HAVE_USLEEP 1
 
+#define HAVE_GETHOSTNAME 1
 #define HAVE_GETCWD 1
 #define HAVE_POSIX_READDIR_R 1
 #define NEED_ISBLANK 1


Reply via email to