1 #ifdef _MSC_VER 2 # if _MSC_VER < 1900 3 # define snprintf _snprintf 4 # endif 5 # if _MSC_VER < 1500 6 # define vsnprintf _vsnprintf 7 # endif 8 # define strncasecmp _strnicmp 9 # define strcasecmp _stricmp 10 #endif 11 12 #include <ctype.h> 13 #include <errno.h> 14 #include <fcntl.h> 15 #include <stdlib.h> 16 #include <string.h> 17 #include <sys/stat.h> 18 #ifdef WIN32 19 # include <direct.h> 20 # define Direntry_t struct direct 21 # include <windows.h> 22 #else 23 # include <dirent.h> 24 # define Direntry_t struct dirent 25 # include <unistd.h> 26 #endif 27 28 #ifndef W_OK 29 #define W_OK 0x02 30 #endif 31 32 #ifndef X_OK 33 #define X_OK 0x04 34 #endif 35 36 #ifndef S_ISDIR 37 # define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) 38 #endif 39 40 #ifndef S_ISLNK 41 # ifdef _S_ISLNK 42 # define S_ISLNK(m) _S_ISLNK(m) 43 # else 44 # ifdef _S_IFLNK 45 # define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK) 46 # else 47 # ifdef S_IFLNK 48 # define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK) 49 # else 50 # define S_ISLNK(m) (0) 51 # endif 52 # endif 53 # endif 54 #endif 55 56 #ifndef S_ISREG 57 #define S_ISREG(x) 1 58 #endif 59 60 #ifndef MAXPATHLEN 61 #define MAXPATHLEN 32767 62 #endif 63 64 #ifdef HAS_LSTAT 65 #define par_lstat lstat 66 #else 67 #define par_lstat stat 68 #endif 69 70 #if defined(WIN32) || defined(OS2) 71 static const char *dir_sep = "\\"; 72 static const char *path_sep = ";"; 73 #else 74 static const char *dir_sep = "/"; 75 static const char *path_sep = ":"; 76 #endif 77 78 79 #ifdef WIN32 80 # include <process.h> 81 # define my_mkdir(file, mode) _mkdir(file) 82 #else 83 # define my_mkdir(file, mode) mkdir(file,mode) 84 #endif 85 86 #include "utils.c" 87 #include "usernamefrompwuid.c" 88 89