Changeset 3186 in kBuild
- Timestamp:
- Mar 23, 2018 10:44:44 PM (7 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/dir.c
r3140 r3186 585 585 586 586 #ifdef WINDOWS32 587 PATH_VAR (w32_fullpath); 587 588 char *w32_path; 588 589 #endif … … 593 594 dc_key.dev = st.st_dev; 594 595 #ifdef WINDOWS32 596 w32_path = unix_slashes_resolved (name, w32_fullpath, GET_PATH_MAX); 595 597 # ifndef CONFIG_WITH_STRCACHE2 596 dc_key.path_key = w32_path = w32ify (name, 1); 598 dc_key.path_key = w32_path; /* = w32ify (name, 1); - bird */ 597 599 # else /* CONFIG_WITH_STRCACHE2 */ 598 w32_path = w32ify (name, 1); 599 dc_key.path_key = strcache_add (w32_path); 600 dc_key.path_key = strcache_add (w32_path); 600 601 # endif /* CONFIG_WITH_STRCACHE2 */ 601 602 dc_key.ctime = st.st_ctime; 602 603 #else 603 604 # ifdef VMS_INO_T -
trunk/src/kmk/function.c
r3159 r3186 2876 2876 2877 2877 #ifdef WINDOWS32 /* bird */ 2878 dest = w32ify((char *)name, 1);2878 dest = unix_slashes_resolved (name, apath, GET_PATH_MAX); 2879 2879 if (!dest) 2880 2880 return NULL; 2881 { 2882 size_t len = strlen(dest); 2883 memcpy(apath, dest, len); 2884 dest = apath + len; 2885 } 2881 dest = strchr(apath, '\0'); 2886 2882 2887 2883 (void)end; (void)start; (void)apath_limit; -
trunk/src/kmk/job.c
r3159 r3186 3830 3830 if (shell) 3831 3831 { 3832 # if 1 /* bird */ 3833 unix_slashes (shell); 3834 # else 3832 3835 char *p = w32ify (shell, 0); 3833 3836 strcpy (shell, p); 3837 # endif 3834 3838 } 3835 3839 #endif -
trunk/src/kmk/main.c
r3170 r3186 1242 1242 batch_mode_shell = 1; 1243 1243 unixy_shell = 0; 1244 # if 1 /* bird: sprintf? wtf. */ 1245 default_shell = unix_slashes (xstrdup (search_token)); 1246 # else 1244 1247 sprintf (sh_path, "%s", search_token); 1245 1248 default_shell = xstrdup (w32ify (sh_path, 0)); 1249 # endif 1246 1250 DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"), 1247 1251 default_shell)); … … 1257 1261 { 1258 1262 /* search token path was found */ 1263 # if 1 /* bird: sprintf? wtf. */ 1264 default_shell = unix_slashes (xstrdup (search_token)); 1265 # else 1259 1266 sprintf (sh_path, "%s", search_token); 1260 1267 default_shell = xstrdup (w32ify (sh_path, 0)); 1268 # endif 1261 1269 DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"), 1262 1270 default_shell)); … … 1280 1288 *ep = '\0'; 1281 1289 1290 # if 1 /* bird: insanity insurance */ 1291 _snprintf (sh_path, GET_PATH_MAX, "%s/%s", p, search_token); 1292 # else 1282 1293 sprintf (sh_path, "%s/%s", p, search_token); 1294 # endif 1283 1295 if (_access (sh_path, 0) == 0) 1284 1296 { 1297 # if 1 /* bird: we can modify sh_path directly. */ 1298 default_shell = xstrdup (unix_slashes (sh_path)); 1299 # else 1285 1300 default_shell = xstrdup (w32ify (sh_path, 0)); 1301 # endif 1286 1302 sh_found = 1; 1287 1303 *ep = PATH_SEPARATOR_CHAR; … … 1302 1318 if (p && *p) 1303 1319 { 1320 # if 1 /* bird: insanity insurance */ 1321 _snprintf (sh_path, GET_PATH_MAX, "%s/%s", p, search_token); 1322 # else 1304 1323 sprintf (sh_path, "%s/%s", p, search_token); 1324 # endif 1305 1325 if (_access (sh_path, 0) == 0) 1306 1326 { 1327 # if 1 /* bird: we can modify sh_path directly. */ 1328 default_shell = xstrdup (unix_slashes (sh_path)); 1329 # else 1307 1330 default_shell = xstrdup (w32ify (sh_path, 0)); 1331 # endif 1308 1332 sh_found = 1; 1309 1333 } … … 2130 2154 if (strpbrk (argv[0], "/:\\") || strstr (argv[0], "..") 2131 2155 || strneq (argv[0], "//", 2)) 2132 argv[0] = xstrdup (w32ify (argv[0], 1)); 2156 # if 1 /* bird */ 2157 { 2158 PATH_VAR (tmp_path_buf); 2159 argv[0] = xstrdup (unix_slashes_resolved (argv[0], tmp_path_buf, 2160 GET_PATH_MAX)); 2161 } 2162 # else /* bird */ 2163 //argv[0] = xstrdup (w32ify (argv[0], 1)); 2164 # endif /* bird */ 2133 2165 #else /* WINDOWS32 */ 2134 2166 #if defined (__MSDOS__) || defined (__EMX__) -
trunk/src/kmk/w32/include/pathstuff.h
r3140 r3186 20 20 char *convert_Path_to_windows32(char *Path, char to_delim); 21 21 char *convert_vpath_to_windows32(char *Path, char to_delim); 22 #if 1 23 char *unix_slashes(char *filename); /* bird */ 24 char *unix_slashes_resolved(const char *src, char *dst, unsigned len); /* bird */ 25 #else 22 26 char *w32ify(const char *filename, int resolve); 27 #endif 23 28 char *getcwd_fs(char *buf, int len); 24 29 -
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.