From 07cfd5754e9b87ed835d3c98f39d24ce3e4ad32a Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Mon, 4 Sep 2000 04:18:38 +0000 Subject: [PATCH] - Added macros --- TSRM/TSRM.dsp | 4 +++ TSRM/tsrm_virtual_cwd.c | 1 - TSRM/tsrm_virtual_cwd.h | 70 ++++++++++++++++++++++++++++++++++++----- 3 files changed, 67 insertions(+), 8 deletions(-) diff --git a/TSRM/TSRM.dsp b/TSRM/TSRM.dsp index 5845700aca..1dde51f148 100644 --- a/TSRM/TSRM.dsp +++ b/TSRM/TSRM.dsp @@ -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 diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index 5589d75dcc..e1d7d492c3 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -48,7 +48,6 @@ #endif #ifdef TSRM_WIN32 -#include #include #endif diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h index 8d4c2c32cd..0a882c364c 100644 --- a/TSRM/tsrm_virtual_cwd.h +++ b/TSRM/tsrm_virtual_cwd.h @@ -50,7 +50,7 @@ #ifdef TSRM_WIN32 #include "readdir.h" - +#include /* 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 -# 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 */ -- 2.40.0