sniper Mon Jul 14 12:23:28 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src/ext/standard dir.c
Log:
MFH
Index: php-src/ext/standard/dir.c
diff -u php-src/ext/standard/dir.c:1.109.2.8 php-src/ext/standard/dir.c:1.109.2.9
--- php-src/ext/standard/dir.c:1.109.2.8 Fri Jul 4 10:40:22 2003
+++ php-src/ext/standard/dir.c Mon Jul 14 12:23:28 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dir.c,v 1.109.2.8 2003/07/04 14:40:22 hholzgra Exp $ */
+/* $Id: dir.c,v 1.109.2.9 2003/07/14 16:23:28 sniper Exp $ */
/* {{{ includes/startup/misc */
@@ -86,7 +86,7 @@
WRONG_PARAM_COUNT; \
} else { \
dirp = (php_stream *) zend_fetch_resource(id TSRMLS_CC, -1,
"Directory", NULL, 1, php_file_le_stream()); \
- if(!dirp) \
+ if (!dirp) \
RETURN_FALSE; \
}
@@ -128,11 +128,13 @@
#ifdef ZTS
ts_allocate_id(&dir_globals_id, sizeof(php_dir_globals), NULL, NULL);
#endif
+
dirsep_str[0] = DEFAULT_SLASH;
dirsep_str[1] = '\0';
REGISTER_STRING_CONSTANT("DIRECTORY_SEPARATOR", dirsep_str,
CONST_CS|CONST_PERSISTENT);
- pathsep_str[0] = ZEND_PATHS_SEPARATOR;
- pathsep_str[1] = '\0';
+
+ pathsep_str[0] = ZEND_PATHS_SEPARATOR;
+ pathsep_str[1] = '\0';
REGISTER_STRING_CONSTANT("PATH_SEPARATOR", pathsep_str,
CONST_CS|CONST_PERSISTENT);
#ifdef HAVE_GLOB
@@ -162,14 +164,13 @@
REGISTER_LONG_CONSTANT("GLOB_ONLYDIR", GLOB_ONLYDIR, CONST_CS |
CONST_PERSISTENT);
-#endif
+#endif /* HAVE_GLOB */
return SUCCESS;
}
-
/* }}} */
-/* {{{ internal functions */
+/* {{{ internal functions */
static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
{
pval **arg;
@@ -197,29 +198,26 @@
php_stream_to_zval(dirp, return_value);
}
}
-
/* }}} */
+
/* {{{ proto mixed opendir(string path)
Open a directory and return a dir_handle */
-
PHP_FUNCTION(opendir)
{
_php_do_opendir(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
-
/* }}} */
+
/* {{{ proto object dir(string directory)
Directory class with properties, handle and class and methods read, rewind and
close */
-
PHP_FUNCTION(getdir)
{
_php_do_opendir(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
-
/* }}} */
+
/* {{{ proto void closedir([resource dir_handle])
Close directory connection identified by the dir_handle */
-
PHP_FUNCTION(closedir)
{
pval **id, **tmp, *myself;
@@ -233,13 +231,11 @@
zend_list_delete(dirp->rsrc_id);
}
-
/* }}} */
#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
/* {{{ proto bool chroot(string directory)
Change root directory */
-
PHP_FUNCTION(chroot)
{
char *str;
@@ -265,13 +261,11 @@
RETURN_TRUE;
}
-
/* }}} */
#endif
/* {{{ proto bool chdir(string directory)
Change the current directory */
-
PHP_FUNCTION(chdir)
{
char *str;
@@ -293,11 +287,10 @@
RETURN_TRUE;
}
-
/* }}} */
+
/* {{{ proto mixed getcwd(void)
Gets the current directory */
-
PHP_FUNCTION(getcwd)
{
char path[MAXPATHLEN];
@@ -311,11 +304,6 @@
ret = VCWD_GETCWD(path, MAXPATHLEN);
#elif HAVE_GETWD
ret = VCWD_GETWD(path);
-/*
- * #warning is not ANSI C
- * #else
- * #warning no proper getcwd support for your site
- */
#endif
if (ret) {
@@ -324,11 +312,10 @@
RETURN_FALSE;
}
}
-
/* }}} */
+
/* {{{ proto void rewinddir([resource dir_handle])
Rewind dir_handle back to the start */
-
PHP_FUNCTION(rewinddir)
{
pval **id, **tmp, *myself;
@@ -342,7 +329,6 @@
/* {{{ proto string readdir([resource dir_handle])
Read directory entry from dir_handle */
-
PHP_NAMED_FUNCTION(php_if_readdir)
{
pval **id, **tmp, *myself;
@@ -356,7 +342,6 @@
}
RETURN_FALSE;
}
-
/* }}} */
#ifdef HAVE_GLOB
@@ -380,7 +365,7 @@
return;
#ifdef ZTS
- if(!IS_ABSOLUTE_PATH(pattern, pattern_len)) {
+ if (!IS_ABSOLUTE_PATH(pattern, pattern_len)) {
result = VCWD_GETCWD(cwd, MAXPATHLEN);
if (!result) {
cwd[0] = '\0';
@@ -420,10 +405,9 @@
if (PG(safe_mode) && (!php_checkuid(cwd, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
}
- if(php_check_open_basedir(cwd TSRMLS_CC)) {
+ if (php_check_open_basedir(cwd TSRMLS_CC)) {
RETURN_FALSE;
}
-
array_init(return_value);
for (n = 0; n < globbuf.gl_pathc; n++) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php