Changeset 2592
- Timestamp:
- Jun 18, 2012, 12:50:38 AM (13 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/config.h.win
r2591 r2592 523 523 #endif 524 524 525 /* bird hacks */525 /* bird hacks - similar in mscfakes.h */ 526 526 #include <sys/stat.h> 527 extern int my_stat(const char *, struct stat *); 528 #define stat(_path, _st) my_stat(_path, _st) 527 #include <io.h> 528 #include <direct.h> 529 #ifndef STAT_REDEFINED_ALREADY 530 # define STAT_REDEFINED_ALREADY 531 # undef stat 532 # define stat(_path, _st) bird_w32_stat(_path, _st) 533 extern int bird_w32_stat(const char *, struct stat *); 534 #endif 529 535 530 536 /* cygwin sucks to much in one end or the other. */ -
trunk/src/kmk/function.c
r2591 r2592 82 82 # define STR_N_EQUALS(a_psz, a_cch, a_szConst) \ 83 83 ( (a_cch) == sizeof (a_szConst) - 1 && !strncmp ((a_psz), (a_szConst), sizeof (a_szConst) - 1) ) 84 85 # ifdef _MSC_VER 86 # include "kmkbuiltin/mscfakes.h" 87 # endif 84 88 #endif 85 89 -
trunk/src/kmk/job.c
r2591 r2592 1129 1129 #else 1130 1130 char **argv; 1131 # if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32) && !defined(VMS) 1131 1132 char ** volatile volatile_argv; 1132 1133 int volatile volatile_flags; 1134 # endif 1133 1135 #endif 1134 1136 -
trunk/src/kmk/kmkbuiltin/mscfakes.c
r2484 r2592 533 533 534 534 535 #undef stat536 535 /* 537 536 * Workaround for directory names with trailing slashes. 538 * Added by bird reasons stated.539 537 */ 538 #undef stat 540 539 int 541 my_other_stat(const char *path, struct stat *st)540 bird_w32_stat(const char *path, struct stat *st) 542 541 { 543 542 int rc = stat(path, st); … … 564 563 } 565 564 } 566 return rc; 567 } 568 565 #ifdef KMK_PRF 566 { 567 int err = errno; 568 fprintf(stderr, "stat(%s,) -> %d/%d\n", path, rc, errno); 569 errno = err; 570 } 571 #endif 572 return rc; 573 } 574 -
trunk/src/kmk/kmkbuiltin/mscfakes.h
r2413 r2592 35 35 #include "getopt.h" 36 36 37 /* Note: Duplicated it config.h.win */ 38 #include <sys/stat.h> 39 #include <io.h> 40 #include <direct.h> 37 41 #if defined(MSC_DO_64_BIT_IO) && _MSC_VER >= 1400 /* We want 64-bit file lengths here when possible. */ 38 42 # define off_t __int64 43 # undef stat 39 44 # define stat _stat64 40 45 # define fstat _fstat64 41 46 # define lseek _lseeki64 42 47 #else 43 # undef stat 44 # define stat(_path, _st) my_other_stat(_path, _st) 45 extern int my_other_stat(const char *, struct stat *); 48 # ifndef STAT_REDEFINED_ALREADY 49 # define STAT_REDEFINED_ALREADY 50 # undef stat 51 # define stat(_path, _st) bird_w32_stat(_path, _st) 52 extern int bird_w32_stat(const char *, struct stat *); 53 # endif 46 54 #endif 47 48 49 55 50 56 #ifndef S_ISDIR -
trunk/src/kmk/vpath.c
r2591 r2592 292 292 Usually this is maxelem - 1. If not, shrink down. */ 293 293 if (elem < (maxelem - 1)) 294 vpath = xrealloc (vpath, (elem+1) * sizeof (const char *));294 vpath = (const char **)xrealloc (vpath, (elem+1) * sizeof (const char *)); 295 295 296 296 /* Put the nil-pointer terminator on the end of the VPATH list. */ -
trunk/src/kmk/w32/pathstuff.c
r2591 r2592 143 143 144 144 return p; 145 }146 147 #undef stat148 /*149 * Workaround for directory names with trailing slashes.150 * Added by bird reasons stated.151 */152 int153 my_stat(const char *path, struct stat *st)154 {155 int rc = stat(path, st);156 if ( rc != 0157 && errno == ENOENT158 && *path != '\0')159 {160 char *slash = strchr(path, '\0') - 1;161 if (*slash == '/' || *slash == '\\')162 {163 size_t len_path = slash - path + 1;164 char *tmp = alloca(len_path + 4);165 memcpy(tmp, path, len_path);166 tmp[len_path] = '.';167 tmp[len_path + 1] = '\0';168 errno = 0;169 rc = stat(tmp, st);170 if ( rc == 0171 && !S_ISDIR(st->st_mode))172 {173 errno = ENOTDIR;174 rc = -1;175 }176 }177 }178 #ifdef KMK_PRF179 {180 int err = errno;181 fprintf(stderr, "stat(%s,) -> %d/%d\n", path, rc, errno);182 errno = err;183 }184 #endif185 return rc;186 145 } 187 146
Note:
See TracChangeset
for help on using the changeset viewer.