notes-merge: switch to use the_hash_algo
[git/debian.git] / compat / win32 / path-utils.c
blobd9d3641de8574506ca1aa9fc00cf5012631a03b6
1 #include "../../git-compat-util.h"
3 int win32_skip_dos_drive_prefix(char **path)
5 int ret = has_dos_drive_prefix(*path);
6 *path += ret;
7 return ret;
10 int win32_offset_1st_component(const char *path)
12 char *pos = (char *)path;
14 /* unc paths */
15 if (!skip_dos_drive_prefix(&pos) &&
16 is_dir_sep(pos[0]) && is_dir_sep(pos[1])) {
17 /* skip server name */
18 pos = strpbrk(pos + 2, "\\/");
19 if (!pos)
20 return 0; /* Error: malformed unc path */
22 do {
23 pos++;
24 } while (*pos && !is_dir_sep(*pos));
27 return pos + is_dir_sep(*pos) - path;