(cut_path_elements): New functon.

This commit is contained in:
Sergey Poznyakoff
2003-09-04 15:47:26 +00:00
parent ddab1f615e
commit 3590887776

View File

@@ -1043,6 +1043,23 @@ safer_name_suffix (char const *file_name, bool link_target)
return (char *) p;
}
char const *
cut_path_elements (char const *file_name, size_t num)
{
char const *p = file_name;
if (ISSLASH (*p))
p++;
for (; *p; p++)
{
if (ISSLASH (*p))
{
if (--num == 0)
return p + 1;
}
}
return NULL;
}
/* Return nonzero if NAME contains ".." as a path name component. */
bool
contains_dot_dot (char const *name)