Added gethostname() to return the current system host name.
- 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)
getprotobynumber \
getservbyname \
getservbyport \
+gethostname \
getrusage \
gettimeofday \
gmtime_r \
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)
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)
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)
}
/* }}} */
+
/* {{{ php_gethostbyaddr */
static char *php_gethostbyaddr(char *ip)
{
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);
/* 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