2000-04-01 17:02:32 +00:00
|
|
|
#ifndef VIRTUAL_CWD_H
|
|
|
|
#define VIRTUAL_CWD_H
|
|
|
|
|
2000-04-01 17:20:29 +00:00
|
|
|
#include "zend.h"
|
2000-04-01 20:11:01 +00:00
|
|
|
#include "zend_API.h"
|
2000-04-01 17:20:29 +00:00
|
|
|
|
2000-04-20 16:38:08 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
#ifndef ZEND_WIN32
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-04-05 19:02:28 +00:00
|
|
|
#ifdef PHP_EXPORTS
|
|
|
|
#define CWD_EXPORTS
|
|
|
|
#endif
|
|
|
|
|
2000-04-01 18:22:46 +00:00
|
|
|
#ifdef ZEND_WIN32
|
2000-04-01 18:11:08 +00:00
|
|
|
# ifdef CWD_EXPORTS
|
|
|
|
# define CWD_API __declspec(dllexport)
|
|
|
|
# else
|
|
|
|
# define CWD_API __declspec(dllimport)
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
#define CWD_API
|
|
|
|
#endif
|
|
|
|
|
2000-04-01 17:02:32 +00:00
|
|
|
typedef struct _cwd_state {
|
|
|
|
char *cwd;
|
|
|
|
int cwd_length;
|
|
|
|
} cwd_state;
|
|
|
|
|
|
|
|
typedef int (*verify_path_func)(const cwd_state *);
|
|
|
|
|
2000-05-16 23:38:51 +00:00
|
|
|
CWD_API void virtual_cwd_startup(void);
|
|
|
|
CWD_API void virtual_cwd_shutdown(void);
|
2000-04-10 17:39:11 +00:00
|
|
|
CWD_API void virtual_cwd_activate(char *filename);
|
2000-04-05 19:02:28 +00:00
|
|
|
CWD_API char *virtual_getcwd_ex(int *length);
|
|
|
|
CWD_API char *virtual_getcwd(char *buf, size_t size);
|
|
|
|
CWD_API int virtual_chdir(char *path);
|
|
|
|
CWD_API int virtual_chdir_file(char *path);
|
|
|
|
CWD_API int virtual_filepath(char *path, char **filepath);
|
2000-04-07 21:16:08 +00:00
|
|
|
CWD_API FILE *virtual_fopen(const char *path, const char *mode);
|
2000-04-30 03:06:00 +00:00
|
|
|
CWD_API int virtual_open(const char *path, int flags, ...);
|
2000-04-29 19:01:58 +00:00
|
|
|
CWD_API int virtual_creat(const char *path, mode_t mode);
|
2000-04-20 16:38:08 +00:00
|
|
|
CWD_API int virtual_stat(const char *path, struct stat *buf);
|
2000-04-20 17:40:03 +00:00
|
|
|
#ifndef ZEND_WIN32
|
2000-04-20 17:24:01 +00:00
|
|
|
CWD_API int virtual_lstat(const char *path, struct stat *buf);
|
2000-04-20 17:40:03 +00:00
|
|
|
#endif
|
2000-05-23 14:36:27 +00:00
|
|
|
CWD_API int virtual_unlink(const char *path);
|
2000-05-23 17:02:21 +00:00
|
|
|
CWD_API int virtual_mkdir(const char *pathname, mode_t mode);
|
|
|
|
CWD_API int virtual_rmdir(const char *pathname);
|
2000-05-23 14:36:27 +00:00
|
|
|
|
2000-04-09 19:54:50 +00:00
|
|
|
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path);
|
2000-04-01 17:02:32 +00:00
|
|
|
|
2000-04-01 20:11:01 +00:00
|
|
|
ZEND_BEGIN_MODULE_GLOBALS(cwd)
|
2000-04-01 17:02:32 +00:00
|
|
|
cwd_state cwd;
|
2000-04-01 20:11:01 +00:00
|
|
|
ZEND_END_MODULE_GLOBALS(cwd)
|
2000-04-01 17:02:32 +00:00
|
|
|
|
|
|
|
#ifdef ZTS
|
2000-04-01 20:11:01 +00:00
|
|
|
# define CWDLS_D zend_cwd_globals *cwd_globals
|
2000-04-01 17:02:32 +00:00
|
|
|
# define CWDLS_DC , CWDLS_D
|
|
|
|
# define CWDLS_C cwd_globals
|
|
|
|
# define CWDLS_CC , CWDLS_C
|
|
|
|
# define CWDG(v) (cwd_globals->v)
|
2000-04-01 20:11:01 +00:00
|
|
|
# define CWDLS_FETCH() zend_cwd_globals *cwd_globals = ts_resource(cwd_globals_id)
|
2000-04-01 17:02:32 +00:00
|
|
|
#else
|
|
|
|
# define CWDLS_D void
|
|
|
|
# define CWDLS_DC
|
|
|
|
# define CWDLS_C
|
|
|
|
# define CWDLS_CC
|
|
|
|
# define CWDG(v) (cwd_globals.v)
|
|
|
|
# define CWDLS_FETCH()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* VIRTUAL_CWD_H */
|