Changeset 361 for trunk/src/gmake/kmkbuiltin/mkdir.c
- Timestamp:
- Dec 13, 2005, 5:42:38 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmake/kmkbuiltin/mkdir.c
r299 r361 39 39 #endif /* not lint */ 40 40 #endif 41 #ifndef _MSC_VER 41 42 #include <sys/cdefs.h> 43 #endif 42 44 //__FBSDID("$FreeBSD: src/bin/mkdir/mkdir.c,v 1.28 2004/04/06 20:06:48 markm Exp $"); 43 45 … … 47 49 //#include <err.h> 48 50 #include <errno.h> 51 #ifndef _MSC_VER 49 52 #include <libgen.h> 53 #endif 50 54 #include <stdio.h> 51 55 #include <stdlib.h> 52 56 #include <string.h> 57 #ifndef _MSC_VER 53 58 #include <sysexits.h> 54 59 #include <unistd.h> 60 #endif 61 62 #ifdef _MSC_VER 63 #define setmode setmode_msc 64 #include <stdarg.h> 65 #include <io.h> 66 #include <direct.h> 67 #undef setmode 68 #include "getopt.h" 69 70 typedef int mode_t; 71 #define EX_USAGE 1 72 void warn(const char *fmt, ...) 73 { 74 int err = errno; 75 va_list args; 76 va_start(args, fmt); 77 fprintf(stderr, "mkdir: "); 78 vfprintf(stderr, fmt, args); 79 fprintf(stderr, ": %s\n", strerror(err)); 80 va_end(args); 81 } 82 83 int mkdir_msc(const char *path, mode_t mode) 84 { 85 int rc = mkdir(path); 86 if (rc) 87 { 88 int len = strlen(path); 89 if (len > 0 && (path[len - 1] == '/' || path[len - 1] == '\\')) 90 { 91 char *str = strdup(path); 92 while (len > 0 && (str[len - 1] == '/' || str[len - 1] == '\\')) 93 str[--len] = '\0'; 94 rc = mkdir(str); 95 free(str); 96 } 97 } 98 return rc; 99 } 100 #define mkdir(a,b) mkdir_msc(a,b) 101 102 char *dirname(char *path) 103 { 104 return path; 105 } 106 107 #define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) 108 #define S_IRWXG 0000070 109 #define S_IRWXO 0000007 110 #define S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) 111 #define S_IXUSR _S_IEXEC 112 #define S_IWUSR _S_IWRITE 113 #define S_IRUSR _S_IREAD 114 115 #endif 55 116 56 117 extern void * setmode(const char *p);
Note:
See TracChangeset
for help on using the changeset viewer.