isAbsolute(const char *path)
{
#if defined(HAVE_WIN32)
- return path[1] == ':' || *path == '/' || *path == '\\'; /* drivespec:/blah is absolute */
+ return path[1] == ':' || IsPathSeparator(*path); /* drivespec:/blah is absolute */
#else
- return *path == '/';
+ return IsPathSeparator(*path);
#endif
}
}
/* Skip over leading slashes. */
-#if defined(HAVE_WIN32)
- while (*slash == '/' || *slash == '\\')
- slash++;
-#else
- while (*slash == '/')
+ while (IsPathSeparator(*slash))
slash++;
-#endif
- while (1) {
+
+ for ( ; ; ) {
int newly_created_dir;
int fail;
/* slash points to the leftmost unprocessed component of dirpath. */
basename_dir = slash;
-
-#if defined(HAVE_WIN32)
- slash = strpbrk(slash, ":/\\");
- if (slash == NULL) {
- break;
- }
-#else
- slash = strchr (slash, '/');
+ slash = first_path_separator(slash);
if (slash == NULL) {
break;
}
-#endif
/* If we're *not* doing chdir before each mkdir, then we have to refer
to the target using the full (multi-component) directory name. */
/* Avoid unnecessary calls to `stat' when given
pathnames containing multiple adjacent slashes. */
-#if defined(HAVE_WIN32)
- while (*slash == '/' || *slash == '\\')
- slash++;
-#else
- while (*slash == '/')
+ while (IsPathSeparator(*slash))
slash++;
-#endif
} /* end while (1) */
if (!cwd.do_chdir) {