cvs: /php4 fopen-wrappers.c fopen-wrappers.h php.h php_virtual_cwd.c php_virtual_cwd.h

From: Date: Sun, 09 Apr 2000 19:55:20 +0000
Subject: cvs: /php4 fopen-wrappers.c fopen-wrappers.h php.h php_virtual_cwd.c php_virtual_cwd.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-13346@lists.php.net to get a copy of this message
andi Sun Apr 9 12:55:20 2000 EDT Modified files: /php4 fopen-wrappers.c fopen-wrappers.h php.h php_virtual_cwd.c php_virtual_cwd.h Log: - Don't need to extern functions - Use virtual_file_ex() in expand_filepath() Index: php4/fopen-wrappers.c diff -u php4/fopen-wrappers.c:1.51 php4/fopen-wrappers.c:1.52 --- php4/fopen-wrappers.c:1.51 Fri Apr 7 15:10:04 2000 +++ php4/fopen-wrappers.c Sun Apr 9 12:54:50 2000 @@ -16,7 +16,7 @@ | Jim Winstead <jimw@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: fopen-wrappers.c,v 1.51 2000/04/07 22:10:04 zeev Exp $ */ +/* $Id: fopen-wrappers.c,v 1.52 2000/04/09 19:54:50 andi Exp $ */ #include "php.h" #include "php_globals.h" @@ -973,8 +973,30 @@ } +#if 1 + PHPAPI char *expand_filepath(char *filepath) { + cwd_state new_state; + char cwd[MAXPATHLEN+1]; + char *result; + + result = getcwd(cwd, MAXPATHLEN); + if (!result) { + cwd[0] = '\0'; + } + + new_state.cwd = strdup(cwd); + new_state.cwd_length = strlen(cwd); + + virtual_file_ex(&new_state, filepath, NULL); + return new_state.cwd; +} + +#else + +PHPAPI char *expand_filepath(char *filepath) +{ char *retval = NULL; if (filepath[0] == '.') { @@ -1012,6 +1034,8 @@ } return retval; } + +#endif /* * Local variables: Index: php4/fopen-wrappers.h diff -u php4/fopen-wrappers.h:1.16 php4/fopen-wrappers.h:1.17 --- php4/fopen-wrappers.h:1.16 Sat Feb 19 15:21:25 2000 +++ php4/fopen-wrappers.h Sun Apr 9 12:54:50 2000 @@ -15,7 +15,7 @@ | Authors: Jim Winstead <jimw@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: fopen-wrappers.h,v 1.16 2000/02/19 23:21:25 zeev Exp $ */ +/* $Id: fopen-wrappers.h,v 1.17 2000/04/09 19:54:50 andi Exp $ */ #ifndef _FOPEN_WRAPPERS_H #define _FOPEN_WRAPPERS_H @@ -64,19 +64,19 @@ #define IS_SOCKET 1 #define BAD_URL 2 -extern PHPAPI FILE *php_fopen_wrapper(char *filename, char *mode, int options, int *issock, int *socketd, char **opened_path); +PHPAPI FILE *php_fopen_wrapper(char *filename, char *mode, int options, int *issock, int *socketd, char **opened_path); PHPAPI FILE *php_fopen_primary_script(void); -extern PHPAPI int php_check_open_basedir(char *path); -extern PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC); +PHPAPI int php_check_open_basedir(char *path); +PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC); -extern PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path); +PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path); -extern PHPAPI int php_is_url(char *path); -extern PHPAPI char *php_strip_url_passwd(char *path); +PHPAPI int php_is_url(char *path); +PHPAPI char *php_strip_url_passwd(char *path); -extern PHPAPI char *expand_filepath(char *filepath); +PHPAPI char *expand_filepath(char *filepath); #endif /* Index: php4/php.h diff -u php4/php.h:1.79 php4/php.h:1.80 --- php4/php.h:1.79 Sat Apr 8 08:01:11 2000 +++ php4/php.h Sun Apr 9 12:54:50 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php.h,v 1.79 2000/04/08 15:01:11 andi Exp $ */ +/* $Id: php.h,v 1.80 2000/04/09 19:54:50 andi Exp $ */ #ifndef _PHP_H #define _PHP_H @@ -285,10 +285,10 @@ #define PUTC_H(c) (php_header_write(&(c), 1), (c)) #define VIRTUAL_DIR +#include "php_virtual_cwd.h" /* Virtual current directory support */ #ifdef VIRTUAL_DIR -#include "php_virtual_cwd.h" #define PHP_GETCWD(buff, size) virtual_getcwd(buff,size) #define PHP_FOPEN(path, mode) virtual_fopen(path, mode) #define PHP_CHDIR(path) virtual_chdir(path) Index: php4/php_virtual_cwd.c diff -u php4/php_virtual_cwd.c:1.29 php4/php_virtual_cwd.c:1.30 --- php4/php_virtual_cwd.c:1.29 Fri Apr 7 14:16:08 2000 +++ php4/php_virtual_cwd.c Sun Apr 9 12:54:50 2000 @@ -211,7 +211,7 @@ /* returns 0 for ok, 1 for error */ -static int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path) +CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path) { int path_length = strlen(path); char *ptr, *path_copy; Index: php4/php_virtual_cwd.h diff -u php4/php_virtual_cwd.h:1.10 php4/php_virtual_cwd.h:1.11 --- php4/php_virtual_cwd.h:1.10 Fri Apr 7 14:16:08 2000 +++ php4/php_virtual_cwd.h Sun Apr 9 12:54:50 2000 @@ -33,6 +33,7 @@ CWD_API int virtual_chdir_file(char *path); CWD_API int virtual_filepath(char *path, char **filepath); CWD_API FILE *virtual_fopen(const char *path, const char *mode); +CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path); ZEND_BEGIN_MODULE_GLOBALS(cwd) cwd_state cwd;

« previous php.version4 (#13346) next »