- Don't need to extern functions

- Use virtual_file_ex() in expand_filepath()
This commit is contained in:
Andi Gutmans 2000-04-09 19:54:50 +00:00
parent 4cdcf638ce
commit c981be0bca
5 changed files with 34 additions and 9 deletions

View file

@ -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

View file

@ -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
/*

View file

@ -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)

View file

@ -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;

View file

@ -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;