cvs: php4 /ext/standard basic_functions.c info.c info.h

From: Date: Sun, 27 Aug 2000 19:42:46 +0000
Subject: cvs: php4 /ext/standard basic_functions.c info.c info.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-1421@lists.php.net to get a copy of this message
ssb Sun Aug 27 12:42:46 2000 EDT Modified files: /php4/ext/standard basic_functions.c info.c info.h Log: @Added php_uname() function (Stig) Added php_uname() function. Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.241 php4/ext/standard/basic_functions.c:1.242 --- php4/ext/standard/basic_functions.c:1.241 Thu Aug 24 20:10:42 2000 +++ php4/ext/standard/basic_functions.c Sun Aug 27 12:42:45 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.241 2000/08/25 03:10:42 ssb Exp $ */ +/* $Id: basic_functions.c,v 1.242 2000/08/27 19:42:45 ssb Exp $ */ #include "php.h" #include "php_main.h" @@ -126,6 +126,7 @@ PHP_FE(php_logo_guid, NULL) PHP_FE(zend_logo_guid, NULL) PHP_FE(php_sapi_name, NULL) + PHP_FE(php_uname, NULL) PHP_FE(strnatcmp, NULL) PHP_FE(strnatcasecmp, NULL) Index: php4/ext/standard/info.c diff -u php4/ext/standard/info.c:1.111 php4/ext/standard/info.c:1.112 --- php4/ext/standard/info.c:1.111 Sat Aug 26 05:53:13 2000 +++ php4/ext/standard/info.c Sun Aug 27 12:42:45 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.c,v 1.111 2000/08/26 12:53:13 rubys Exp $ */ +/* $Id: info.c,v 1.112 2000/08/27 19:42:45 ssb Exp $ */ #include "php.h" #include "php_ini.h" @@ -121,20 +121,37 @@ } -PHPAPI void php_print_info(int flag) +PHPAPI char *php_get_uname() { - char **env,*tmp1,*tmp2; char *php_uname; - int expose_php = INI_INT("expose_php"); - time_t the_time; - struct tm *ta, tmbuf; #ifdef PHP_WIN32 char php_windows_uname[256]; DWORD dwBuild=0; DWORD dwVersion = GetVersion(); DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); + + /* Get build numbers for Windows NT or Win95 */ + if (dwVersion < 0x80000000){ + dwBuild = (DWORD)(HIWORD(dwVersion)); + snprintf(php_windows_uname,255,"%s %d.%d build %d","Windows NT",dwWindowsMajorVersion,dwWindowsMinorVersion,dwBuild); + } else { + snprintf(php_windows_uname,255,"%s %d.%d","Windows 95/98",dwWindowsMajorVersion,dwWindowsMinorVersion); + } + php_uname = php_windows_uname; +#else + php_uname=PHP_UNAME; #endif + return estrdup(php_uname); +} + +PHPAPI void php_print_info(int flag) +{ + char **env,*tmp1,*tmp2; + char *php_uname; + int expose_php = INI_INT("expose_php"); + time_t the_time; + struct tm *ta, tmbuf; ELS_FETCH(); SLS_FETCH(); @@ -146,18 +163,7 @@ if (flag & PHP_INFO_GENERAL) { char *zend_version = get_zend_version(); -#ifdef PHP_WIN32 - /* Get build numbers for Windows NT or Win95 */ - if (dwVersion < 0x80000000){ - dwBuild = (DWORD)(HIWORD(dwVersion)); - snprintf(php_windows_uname,255,"%s %d.%d build %d","Windows NT",dwWindowsMajorVersion,dwWindowsMinorVersion,dwBuild); - } else { - snprintf(php_windows_uname,255,"%s %d.%d","Windows 95/98",dwWindowsMajorVersion,dwWindowsMinorVersion); - } - php_uname = php_windows_uname; -#else - php_uname=PHP_UNAME; -#endif + php_uname = php_get_uname(); php_info_print_style(); @@ -219,6 +225,7 @@ zend_html_puts(zend_version, strlen(zend_version)); php_printf("</BR>\n"); php_info_print_box_end(); + efree(php_uname); } if ((flag & PHP_INFO_CREDITS) && expose_php) { @@ -642,7 +649,7 @@ RETURN_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1); } -/* {{{ proto string sapi_module_name(void) +/* {{{ proto string php_sapi_name(void) Return the current SAPI module name */ PHP_FUNCTION(php_sapi_name) { @@ -651,6 +658,15 @@ } else { RETURN_FALSE; } +} + +/* }}} */ + +/* {{{ proto string php_uname(void) + Return information about the system PHP was built on */ +PHP_FUNCTION(php_uname) +{ + RETURN_STRING(php_get_uname(), 0); } /* }}} */ Index: php4/ext/standard/info.h diff -u php4/ext/standard/info.h:1.16 php4/ext/standard/info.h:1.17 --- php4/ext/standard/info.h:1.16 Mon Aug 21 02:50:52 2000 +++ php4/ext/standard/info.h Sun Aug 27 12:42:45 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.h,v 1.16 2000/08/21 09:50:52 sas Exp $ */ +/* $Id: info.h,v 1.17 2000/08/27 19:42:45 ssb Exp $ */ #ifndef INFO_H #define INFO_H @@ -55,6 +55,7 @@ PHP_FUNCTION(zend_logo_guid); PHP_FUNCTION(php_egg_logo_guid); PHP_FUNCTION(php_sapi_name); +PHP_FUNCTION(php_uname); PHPAPI void php_print_info(int flag); PHPAPI void php_print_credits(int flag); PHPAPI void php_print_style(void);

« previous php.cvs (#1421) next »