}
+#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;
return retval;
}
+#endif
+
/*
* Local variables:
* tab-width: 4
#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
/*
#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)
/* 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;
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;