Windows: get_past_head() (#5199)

Reported in #4955, get_past_head() is supposed to return a pointer
after the head of the path (/ in UNIX, c:\ in Windows) but the windows
case was removed.

Removed the Mac reference in the comment, since there no special
handling for Mac.

vim-patch:0
This commit is contained in:
Rui Abreu Ferreira 2016-08-13 14:08:31 +01:00 committed by Justin M. Keyes
parent 79ef4b72d7
commit fb98145aa2

View File

@ -172,19 +172,23 @@ char_u *path_next_component(char_u *fname)
return fname;
}
/*
* Get a pointer to one character past the head of a path name.
* Unix: after "/"; DOS: after "c:\"; Mac: no head.
* If there is no head, path is returned.
*/
/// Get a pointer to one character past the head of a path name.
/// Unix: after "/"; Win: after "c:\"
/// If there is no head, path is returned.
char_u *get_past_head(char_u *path)
{
char_u *retval;
char_u *retval = path;
retval = path;
#ifdef WIN32
// May skip "c:"
if (isalpha(path[0]) && path[1] == ':') {
retval = path + 2;
}
#endif
while (vim_ispathsep(*retval))
while (vim_ispathsep(*retval)) {
++retval;
}
return retval;
}