Changeset 2546 for trunk/src/kmk/kmkbuiltin/haikufakes.c
- Timestamp:
- Oct 1, 2011, 9:49:54 PM (14 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmkbuiltin/haikufakes.c
r2545 r2546 1 1 /* $Id$ */ 2 2 /** @file 3 * Fake Unix stuff for Solaris.3 * Fake Unix/BSD stuff for Haiku. 4 4 */ 5 5 … … 33 33 #include <stdlib.h> 34 34 #include <sys/stat.h> 35 #include " solfakes.h"35 #include "haikufakes.h" 36 36 37 37 38 int asprintf(char **strp, const char *fmt, ...) 39 { 40 int rc; 41 va_list va; 42 va_start(va, fmt); 43 rc = vasprintf(strp, fmt, va); 44 va_end(va); 45 return rc; 46 } 47 48 49 int vasprintf(char **strp, const char *fmt, va_list va) 50 { 51 int rc; 52 char *psz; 53 size_t cb = 1024; 54 55 *strp = NULL; 56 for (;;) 57 { 58 va_list va2; 59 60 psz = malloc(cb); 61 if (!psz) 62 return -1; 63 64 #ifdef va_copy 65 va_copy(va2, va); 66 rc = snprintf(psz, cb, fmt, va2); 67 va_end(va2); 68 #else 69 va2 = va; 70 rc = snprintf(psz, cb, fmt, va2); 71 #endif 72 if (rc < 0 || (size_t)rc < cb) 73 break; 74 cb *= 2; 75 free(psz); 76 } 77 78 *strp = psz; 79 return rc; 80 } 81 82 83 84 int sol_lchmod(const char *pszPath, mode_t mode) 38 int haiku_lchmod(const char *pszPath, mode_t mode) 85 39 { 86 40 /*
Note:
See TracChangeset
for help on using the changeset viewer.