--- ray/src/common/paths.h 2004/10/30 04:59:41 2.21 +++ ray/src/common/paths.h 2012/06/29 23:09:06 2.24 @@ -1,4 +1,4 @@ -/* RCSid $Id: paths.h,v 2.21 2004/10/30 04:59:41 greg Exp $ */ +/* RCSid $Id: paths.h,v 2.24 2012/06/29 23:09:06 greg Exp $ */ /* * Definitions for paths on different machines */ @@ -14,19 +14,17 @@ #ifdef _WIN32 #include - #include /* getcwd(), chdir(), etc. */ + #include /* getcwd(), chdir(), _mkdir(), etc. */ #define access _access + #define mkdir(dirname,perms) _mkdir(dirname) #define PATH_MAX _MAX_PATH #define NULL_DEVICE "NUL" #define DIRSEP '/' - #define ISDIRSEP(c) ((c)=='/' || (c)=='\\') - #define ISABS(s) ((s)!=NULL \ - && (s[0])!='\0' \ - && ( ISDIRSEP(s[0]) \ - || ( (s[1])!='\0' \ - && (isupper(s[0])||islower(s[0])) \ - && (s[1])==':'))) + #define ISDIRSEP(c) (((c)=='/') | ((c)=='\\')) + #define ISABS(s) ( ISDIRSEP((s)[0]) \ + || ( isupper((s)[0]) | islower((s)[0]) \ + && (s)[1]==':' && ISDIRSEP((s)[2]) ) ) #define CASEDIRSEP case '/': case '\\' #define PATHSEP ';' #define CURDIR '.' @@ -40,10 +38,12 @@ /* only does half the work for access() */ #ifndef F_OK #define F_OK 00 - #define X_OK 01 #define W_OK 02 - #define R_OK 04 #endif + #ifndef R_OK + #define X_OK 01 + #define R_OK 04 + #endif /* to make the permissions user specific we'd need to use CreateFile() */ #ifndef S_IRUSR #define S_IRUSR _S_IREAD @@ -74,7 +74,7 @@ #define NULL_DEVICE "NIL:" #define DIRSEP '/' - #define ISABS(s) ((s)!=NULL && (ISDIRSEP(s[0]))) + #define ISABS(s) ISDIRSEP((s)[0]) #define PATHSEP ';' #define CURDIR '.' #define DEFAULT_TEMPDIRS {"/var/tmp", "/usr/tmp", "/tmp", ".", NULL} @@ -93,7 +93,7 @@ /* this is defined as _PATH_DEVNULL in /usr/include/paths.h on Linux */ #define NULL_DEVICE "/dev/null" #define DIRSEP '/' - #define ISABS(s) ((s)!=NULL && (ISDIRSEP(s[0]))) + #define ISABS(s) ISDIRSEP((s)[0]) #define PATHSEP ':' #define CURDIR '.' #define DEFAULT_TEMPDIRS {"/var/tmp", "/usr/tmp", "/tmp", ".", NULL}