Changeset 3186 for trunk/src/kmk/w32/pathstuff.c
- Timestamp:
- Mar 23, 2018, 11:44:44 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/w32/pathstuff.c
r3140 r3186 21 21 #if 1 /* bird */ 22 22 # include "nt_fullpath.h" 23 # include <assert.h> 23 24 #endif 24 25 … … 95 96 96 97 /* 98 * Convert to forward slashes directly (w32ify(filename, 0)). 99 */ 100 char *unix_slashes(char *filename) /* bird */ 101 { 102 char *slash = filename ; 103 while ((slash = strchr(slash, '\\')) != NULL) 104 *slash++ = '/'; 105 return filename; 106 } 107 108 /* 109 * Resolve and convert to forward slashes directly (w32ify(filename, 1)). 110 * Returns if out of buffer space. 111 */ 112 char *unix_slashes_resolved(const char *src, char *dst, unsigned len) 113 { 114 assert(len >= FILENAME_MAX); 115 *dst = '\0'; /** @todo nt_fullpath_cached needs to return some indication of overflow. */ 116 #if 1 117 nt_fullpath_cached(src, dst, len); 118 #else 119 _fullpath(dst, src, len); 120 #endif 121 122 return unix_slashes(dst); 123 } 124 125 #if 0 /* bird: replaced by unix_slashes and unix_slahes_resolved. */ 126 /* 97 127 * Convert to forward slashes. Resolve to full pathname optionally 98 128 */ … … 101 131 { 102 132 static char w32_path[FILENAME_MAX]; 103 char *p;104 105 133 #if 1 /* bird */ 134 106 135 if (resolve) { 107 136 nt_fullpath_cached(filename, w32_path, sizeof(w32_path)); … … 110 139 strncat(w32_path, filename, sizeof(w32_path)); 111 140 } 141 return unix_slashes(w32_path); 142 112 143 #else /* !bird */ 144 char *p; 145 113 146 if (resolve) { 114 147 _fullpath(w32_path, filename, sizeof (w32_path)); 115 148 } else 116 149 strncpy(w32_path, filename, sizeof (w32_path)); 117 #endif /* !bird */118 150 119 151 for (p = w32_path; p && *p; p++) … … 122 154 123 155 return w32_path; 124 } 156 #endif /* !bird */ 157 } 158 #endif 125 159 126 160 char * … … 130 164 131 165 if (p) { 166 #if 1 167 p = unix_slashes(p); 168 #else 132 169 char *q = w32ify(buf, 0); 133 170 #if 1 /* bird - UPSTREAM? */ 134 135 171 buf[0] = '\0'; 172 strncat(buf, q, len); 136 173 #else /* !bird */ 137 174 strncpy(buf, q, len); 175 #endif 138 176 #endif 139 177 }
Note:
See TracChangeset
for help on using the changeset viewer.