diff options
author | Andi Gutmans <andi@php.net> | 2000-04-09 19:54:50 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2000-04-09 19:54:50 +0000 |
commit | c981be0bca1e37754de77c500b962ec277860013 (patch) | |
tree | 7d35a2c788624ecc7824939f614eab242f761a51 | |
parent | 4cdcf638ce793d10e879c8481d88284aef8d914f (diff) | |
download | php-git-c981be0bca1e37754de77c500b962ec277860013.tar.gz |
- Don't need to extern functions
- Use virtual_file_ex() in expand_filepath()
-rw-r--r-- | main/fopen_wrappers.c | 24 | ||||
-rw-r--r-- | main/fopen_wrappers.h | 14 | ||||
-rw-r--r-- | main/php.h | 2 | ||||
-rw-r--r-- | main/php_virtual_cwd.c | 2 | ||||
-rw-r--r-- | main/php_virtual_cwd.h | 1 |
5 files changed, 34 insertions, 9 deletions
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 1d6797997a..116985675e 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -973,6 +973,28 @@ PHPAPI char *php_strip_url_passwd(char *url) } +#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; @@ -1013,6 +1035,8 @@ PHPAPI char *expand_filepath(char *filepath) return retval; } +#endif + /* * Local variables: * tab-width: 4 diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h index 68beba3e22..8d59e4d79f 100644 --- a/main/fopen_wrappers.h +++ b/main/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 /* diff --git a/main/php.h b/main/php.h index 6aee80c41f..c1ab278232 100644 --- a/main/php.h +++ b/main/php.h @@ -285,10 +285,10 @@ PHPAPI int cfg_get_string(char *varname, char **result); #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) diff --git a/main/php_virtual_cwd.c b/main/php_virtual_cwd.c index 9514ab49f2..8dd87dc57e 100644 --- a/main/php_virtual_cwd.c +++ b/main/php_virtual_cwd.c @@ -211,7 +211,7 @@ CWD_API char *virtual_getcwd(char *buf, size_t size) /* 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; diff --git a/main/php_virtual_cwd.h b/main/php_virtual_cwd.h index afe8da00b0..252bd74b64 100644 --- a/main/php_virtual_cwd.h +++ b/main/php_virtual_cwd.h @@ -33,6 +33,7 @@ CWD_API int virtual_chdir(char *path); 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; |