Changeset 1194 for trunk/src/kmk/kmkbuiltin/cp.c
- Timestamp:
- Oct 6, 2007, 3:59:35 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmkbuiltin/cp.c
r1183 r1194 100 100 #endif 101 101 102 #if defined(__WIN32__) || defined(__WIN64__) || defined(__OS2__) 103 # define IS_SLASH(ch) ((ch) == '/' || (ch) == '\\') 104 #else 105 # define IS_SLASH(ch) ((ch) == '/') 106 #endif 107 102 108 #define STRIP_TRAILING_SLASH(p) { \ 103 while ((p).p_end > (p).p_path + 1 && (p).p_end[-1] == '/') \109 while ((p).p_end > (p).p_path + 1 && IS_SLASH((p).p_end[-1])) \ 104 110 *--(p).p_end = 0; \ 105 111 } … … 257 263 *to.p_end = 0; 258 264 } 259 have_trailing_slash = (to.p_end[-1] == '/');265 have_trailing_slash = IS_SLASH(to.p_end[-1]); 260 266 if (have_trailing_slash) 261 267 STRIP_TRAILING_SLASH(to); … … 388 394 if (type != DIR_TO_DNE) { 389 395 p = strrchr(curr->fts_path, '/'); 396 #if defined(__WIN32__) || defined(__WIN64__) || defined(__OS2__) 397 if (strrchr(curr->fts_path, '\\') > p) 398 p = strrchr(curr->fts_path, '\\'); 399 #endif 390 400 base = (p == NULL) ? 0 : 391 401 (int)(p - curr->fts_path + 1); … … 401 411 nlen = curr->fts_pathlen - base; 402 412 target_mid = to.target_end; 403 if ( *p != '/' && target_mid[-1] != '/')413 if (!IS_SLASH(*p) && !IS_SLASH(target_mid[-1])) 404 414 *target_mid++ = '/'; 405 415 *target_mid = 0;
Note:
See TracChangeset
for help on using the changeset viewer.