cvs: php4 / php.h php_virtual_cwd.c php_virtual_cwd.h /ext/standard/ dir.c

From: Date: Sun, 04 Jun 2000 08:29:11 +0000
Subject: cvs: php4 / php.h php_virtual_cwd.c php_virtual_cwd.h /ext/standard/ dir.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-16127@lists.php.net to get a copy of this message
stas Sun Jun 4 01:29:11 2000 EDT Modified files: /php4 php.h php_virtual_cwd.c php_virtual_cwd.h /php4/ext/standard dir.c Log: add opendir to VIRTUAL_DIR Index: php4/php.h diff -u php4/php.h:1.101 php4/php.h:1.102 --- php4/php.h:1.101 Fri Jun 2 05:35:53 2000 +++ php4/php.h Sun Jun 4 01:29:11 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php.h,v 1.101 2000/06/02 12:35:53 zeev Exp $ */ +/* $Id: php.h,v 1.102 2000/06/04 08:29:11 stas Exp $ */ #ifndef _PHP_H #define _PHP_H @@ -306,6 +306,7 @@ #define V_UNLINK(path) virtual_unlink(path) #define V_MKDIR(pathname, mode) virtual_mkdir(pathname, mode) #define V_RMDIR(pathname) virtual_rmdir(pathname) +#define V_OPENDIR(pathname) virtual_opendir(pathname) #else #define V_GETCWD(buff, size) getcwd(buff,size) #define V_FOPEN(path, mode) fopen(path, mode) @@ -319,6 +320,7 @@ #define V_UNLINK(path) unlink(path) #define V_MKDIR(pathname, mode) mkdir(pathname, mode) #define V_RMDIR(pathname) rmdir(pathname) +#define V_OPENDIR(pathname) opendir(pathname) #endif #include "zend_constants.h" Index: php4/php_virtual_cwd.c diff -u php4/php_virtual_cwd.c:1.50 php4/php_virtual_cwd.c:1.51 --- php4/php_virtual_cwd.c:1.50 Sun Jun 4 00:59:32 2000 +++ php4/php_virtual_cwd.c Sun Jun 4 01:29:11 2000 @@ -533,6 +533,21 @@ return retval; } +CWD_API DIR *virtual_opendir(const char *pathname) +{ + cwd_state new_state; + DIR *retval; + CWDLS_FETCH(); + + CWD_STATE_COPY(&new_state, &CWDG(cwd)); + virtual_file_ex(&new_state, pathname, NULL); + + retval = opendir(new_state.cwd); + + CWD_STATE_FREE(&new_state); + return retval; +} + #if 0 main(void) Index: php4/php_virtual_cwd.h diff -u php4/php_virtual_cwd.h:1.23 php4/php_virtual_cwd.h:1.24 --- php4/php_virtual_cwd.h:1.23 Tue May 23 10:02:21 2000 +++ php4/php_virtual_cwd.h Sun Jun 4 01:29:11 2000 @@ -11,6 +11,13 @@ #include <unistd.h> #endif +#ifdef ZEND_WIN32 +#include "win32/readdir.h" +#else +#ifdef HAVE_DIRENT_H +#include <dirent.h> +#endif +#endif #ifdef PHP_EXPORTS #define CWD_EXPORTS @@ -51,6 +58,7 @@ CWD_API int virtual_unlink(const char *path); CWD_API int virtual_mkdir(const char *pathname, mode_t mode); CWD_API int virtual_rmdir(const char *pathname); +CWD_API DIR *virtual_opendir(const char *pathname); CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path); Index: php4/ext/standard/dir.c diff -u php4/ext/standard/dir.c:1.35 php4/ext/standard/dir.c:1.36 --- php4/ext/standard/dir.c:1.35 Sun Jun 4 00:57:40 2000 +++ php4/ext/standard/dir.c Sun Jun 4 01:29:11 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dir.c,v 1.35 2000/06/04 07:57:40 stas Exp $ */ +/* $Id: dir.c,v 1.36 2000/06/04 08:29:11 stas Exp $ */ /* {{{ includes/startup/misc */ @@ -141,7 +141,7 @@ dirp = emalloc(sizeof(php_dir)); - dirp->dir = opendir((*arg)->value.str.val); + dirp->dir = V_OPENDIR((*arg)->value.str.val); if (! dirp->dir) { efree(dirp);

« previous php.version4 (#16127) next »