home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 15 / AACD15.ISO / AACD / Magazine / HomeAutomation / Apache / include / php / main / php_virtual_cwd.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  3.4 KB  |  106 lines

  1. /*
  2.    +----------------------------------------------------------------------+
  3.    | PHP version 4.0                                                      |
  4.    +----------------------------------------------------------------------+
  5.    | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group                   |
  6.    +----------------------------------------------------------------------+
  7.    | This source file is subject to version 2.01 of the PHP license,      |
  8.    | that is bundled with this package in the file LICENSE, and is        |
  9.    | available at through the world-wide-web at                           |
  10.    | http://www.php.net/license/2_02.txt.                                 |
  11.    | If you did not receive a copy of the PHP license and are unable to   |
  12.    | obtain it through the world-wide-web, please send a note to          |
  13.    | license@php.net so we can mail you a copy immediately.               |
  14.    +----------------------------------------------------------------------+
  15.    | Authors: Andi Gutmans <andi@zend.com>                                |
  16.    |          Sascha Schumann <ss@schumann.cx>                            |
  17.    +----------------------------------------------------------------------+
  18. */
  19.  
  20. #ifndef VIRTUAL_CWD_H
  21. #define VIRTUAL_CWD_H
  22.  
  23. #include "zend.h"
  24. #include "zend_API.h"
  25.  
  26. #include <sys/types.h>
  27. #include <sys/stat.h>
  28.  
  29. #ifndef ZEND_WIN32
  30. #include <unistd.h>
  31. #endif
  32.  
  33. #ifdef ZEND_WIN32
  34. #include "win32/readdir.h"
  35. #else
  36. #ifdef HAVE_DIRENT_H
  37. #include <dirent.h>
  38. #endif
  39. #endif
  40.  
  41. #ifdef PHP_EXPORTS
  42. #define CWD_EXPORTS
  43. #endif
  44.  
  45. #ifdef ZEND_WIN32
  46. #       ifdef CWD_EXPORTS
  47. #       define CWD_API __declspec(dllexport)
  48. #       else
  49. #       define CWD_API __declspec(dllimport)
  50. #       endif
  51. #else
  52. #define CWD_API
  53. #endif
  54.  
  55. typedef struct _cwd_state {
  56.     char *cwd;
  57.     int cwd_length;
  58. } cwd_state;
  59.  
  60. typedef int (*verify_path_func)(const cwd_state *);
  61.  
  62. CWD_API void virtual_cwd_startup(void);
  63. CWD_API void virtual_cwd_shutdown(void);
  64. CWD_API void virtual_cwd_activate(char *filename);
  65. CWD_API char *virtual_getcwd_ex(int *length);
  66. CWD_API char *virtual_getcwd(char *buf, size_t size);
  67. CWD_API int virtual_chdir(char *path);
  68. CWD_API int virtual_chdir_file(char *path);
  69. CWD_API int virtual_filepath(char *path, char **filepath);
  70. CWD_API FILE *virtual_fopen(const char *path, const char *mode);
  71. CWD_API int virtual_open(const char *path, int flags, ...);
  72. CWD_API int virtual_creat(const char *path, mode_t mode);
  73. CWD_API int virtual_stat(const char *path, struct stat *buf);
  74. #ifndef ZEND_WIN32
  75. CWD_API int virtual_lstat(const char *path, struct stat *buf);
  76. #endif
  77. CWD_API int virtual_unlink(const char *path);
  78. CWD_API int virtual_mkdir(const char *pathname, mode_t mode);
  79. CWD_API int virtual_rmdir(const char *pathname);
  80. CWD_API DIR *virtual_opendir(const char *pathname);
  81. CWD_API FILE *virtual_popen(const char *command, const char *type);
  82.  
  83. CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path);
  84.  
  85. ZEND_BEGIN_MODULE_GLOBALS(cwd)
  86.     cwd_state cwd;
  87. ZEND_END_MODULE_GLOBALS(cwd)
  88.  
  89. #ifdef ZTS
  90. # define CWDLS_D  zend_cwd_globals *cwd_globals
  91. # define CWDLS_DC , CWDLS_D
  92. # define CWDLS_C  cwd_globals
  93. # define CWDLS_CC , CWDLS_C
  94. # define CWDG(v) (cwd_globals->v)
  95. # define CWDLS_FETCH()    zend_cwd_globals *cwd_globals = ts_resource(cwd_globals_id)
  96. #else
  97. # define CWDLS_D  void
  98. # define CWDLS_DC
  99. # define CWDLS_C
  100. # define CWDLS_CC
  101. # define CWDG(v) (cwd_globals.v)
  102. # define CWDLS_FETCH()
  103. #endif
  104.  
  105. #endif /* VIRTUAL_CWD_H */
  106.