iliaa Wed Dec 31 14:33:41 2008 UTC Modified files: /php-src/ext/standard dns.c dns.h basic_functions.c /php-src configure.in Log: MFB: Added gethostname() to return the current system host name. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.96&r2=1.97&diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.96 php-src/ext/standard/dns.c:1.97 --- php-src/ext/standard/dns.c:1.96 Wed Dec 31 11:12:36 2008 +++ php-src/ext/standard/dns.c Wed Dec 31 14:33:41 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dns.c,v 1.96 2008/12/31 11:12:36 sebastian Exp $ */ +/* $Id: dns.c,v 1.97 2008/12/31 14:33:41 iliaa Exp $ */ /* {{{ includes */ #include "php.h" @@ -107,6 +107,28 @@ 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) U Get the Internet host name corresponding to a given IP address */ PHP_FUNCTION(gethostbyaddr) @@ -134,6 +156,7 @@ } /* }}} */ + /* {{{ php_gethostbyaddr */ static char *php_gethostbyaddr(char *ip) { http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.h?r1=1.23&r2=1.24&diff_format=u Index: php-src/ext/standard/dns.h diff -u php-src/ext/standard/dns.h:1.23 php-src/ext/standard/dns.h:1.24 --- php-src/ext/standard/dns.h:1.23 Wed Dec 31 11:12:36 2008 +++ php-src/ext/standard/dns.h Wed Dec 31 14:33:41 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dns.h,v 1.23 2008/12/31 11:12:36 sebastian Exp $ */ +/* $Id: dns.h,v 1.24 2008/12/31 14:33:41 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.944&r2=1.945&diff_format=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.944 php-src/ext/standard/basic_functions.c:1.945 --- php-src/ext/standard/basic_functions.c:1.944 Wed Dec 31 11:12:36 2008 +++ php-src/ext/standard/basic_functions.c Wed Dec 31 14:33:41 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.944 2008/12/31 11:12:36 sebastian Exp $ */ +/* $Id: basic_functions.c,v 1.945 2008/12/31 14:33:41 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -980,6 +980,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) @@ -3006,6 +3011,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.669&r2=1.670&diff_format=u Index: php-src/configure.in diff -u php-src/configure.in:1.669 php-src/configure.in:1.670 --- php-src/configure.in:1.669 Fri Dec 12 23:55:48 2008 +++ php-src/configure.in Wed Dec 31 14:33:41 2008 @@ -1,4 +1,4 @@ -## $Id: configure.in,v 1.669 2008/12/12 23:55:48 nlopess Exp $ -*- autoconf -*- +## $Id: configure.in,v 1.670 2008/12/31 14:33:41 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 \
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php