]> granicus.if.org Git - php/commitdiff
- Added macros
authorAndi Gutmans <andi@php.net>
Mon, 4 Sep 2000 04:18:38 +0000 (04:18 +0000)
committerAndi Gutmans <andi@php.net>
Mon, 4 Sep 2000 04:18:38 +0000 (04:18 +0000)
TSRM/TSRM.dsp
TSRM/tsrm_virtual_cwd.c
TSRM/tsrm_virtual_cwd.h

index 5845700acafd446492bb9fc9ceaa96a79b3f63cb..1dde51f148541565a85a4397c526eae6445bb5da 100644 (file)
@@ -130,6 +130,10 @@ SOURCE=.\TSRM.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\tsrm_config.w32.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\tsrm_strtok_r.h
 # End Source File
 # Begin Source File
index 5589d75dcc2ca8855ac7c5b5f698c389f779ac2a..e1d7d492c31ccd6b8c16eb43e1fd0991a9a0c44b 100644 (file)
@@ -48,7 +48,6 @@
 #endif
 
 #ifdef TSRM_WIN32
-#include <sys/utime.h>
 #include <io.h>
 #endif
 
index 8d4c2c32cd5b16a58b23fd6d69087c513303fd21..0a882c364cfec70cc5283cf1b3b111c4e10da354 100644 (file)
@@ -50,7 +50,7 @@
 
 #ifdef TSRM_WIN32
 #include "readdir.h"
-
+#include <sys/utime.h>
 /* mode_t isn't defined on Windows */
 typedef int mode_t;
 
@@ -73,12 +73,6 @@ typedef int mode_t;
        (IS_SLASH(path[0]))
 #endif
 
-#if HAVE_UTIME
-# ifdef TSRM_WIN32
-#  include <sys/utime.h>
-# endif
-#endif
-
 #ifdef TSRM_EXPORTS
 #define CWD_EXPORTS
 #endif
@@ -150,4 +144,66 @@ typedef struct _virtual_cwd_globals {
 # define CWDLS_FETCH()
 #endif
 
+/* The actual macros to be used in programs using TSRM
+ * If the program defines VIRTUAL_DIR it will use the
+ * virtual_* functions 
+ */
+
+#ifdef VIRTUAL_DIR
+
+#define V_GETCWD(buff, size) virtual_getcwd(buff,size)
+#define V_FOPEN(path, mode) virtual_fopen(path, mode)
+/* The V_OPEN macro will need to be used as V_OPEN((path, flags, ...)) */
+#define V_OPEN(open_args) virtual_open open_args
+#define V_CREAT(path, mode) virtual_creat(path, mode)
+#define V_CHDIR(path) virtual_chdir(path)
+#define V_CHDIR_FILE(path) virtual_chdir_file(path, virtual_chdir)
+#define V_GETWD(buf)
+#define V_REALPATH(path,real_path) virtual_realpath(path,real_path)
+#define V_STAT(path, buff) virtual_stat(path, buff)
+#ifdef TSRM_WIN32
+#define V_LSTAT(path, buff) virtual_stat(path, buff)
+#else
+#define V_LSTAT(path, buff) virtual_lstat(path, buff)
+#endif
+#define V_UNLINK(path) virtual_unlink(path)
+#define V_MKDIR(pathname, mode) virtual_mkdir(pathname, mode)
+#define V_RMDIR(pathname) virtual_rmdir(pathname)
+#define V_OPENDIR(pathname) virtual_opendir(pathname)
+#define V_POPEN(command, type) virtual_popen(command, type)
+#if HAVE_UTIME
+#define V_UTIME(path,time) virtual_utime(path,time)
+#endif
+#define V_CHMOD(path,mode) virtual_chmod(path,mode)
+#ifndef TSRM_WIN32
+#define V_CHOWN(path,owner,group) virtual_chown(path,owner,group)
+#endif
+
+#else
+
+#define V_GETCWD(buff, size) getcwd(buff,size)
+#define V_FOPEN(path, mode)  fopen(path, mode)
+#define V_OPEN(open_args) open open_args
+#define V_CREAT(path, mode) creat(path, mode)
+#define V_CHDIR(path) chdir(path)
+#define V_CHDIR_FILE(path) virtual_chdir_file(path, chdir)
+#define V_GETWD(buf) getwd(buf)
+#define V_STAT(path, buff) stat(path, buff)
+#define V_LSTAT(path, buff) lstat(path, buff)
+#define V_UNLINK(path) unlink(path)
+#define V_MKDIR(pathname, mode) mkdir(pathname, mode)
+#define V_RMDIR(pathname) rmdir(pathname)
+#define V_OPENDIR(pathname) opendir(pathname)
+#define V_POPEN(command, type) popen(command, type)
+#define V_REALPATH(path,real_path) realpath(path,real_path)
+#if HAVE_UTIME
+#define V_UTIME(path,time) utime(path,time)
+#endif
+#define V_CHMOD(path,mode) chmod(path,mode)
+#ifndef TSRM_WIN32
+#define V_CHOWN(path,owner,group) chown(path,owner,group)
+#endif
+
+#endif
+
 #endif /* VIRTUAL_CWD_H */