Add path_filename()
This commit is contained in:
parent
ce4552add5
commit
49743d4b9e
@ -100,3 +100,15 @@ path_remove_trailing(char *path)
|
|||||||
path[i] = '\0';
|
path[i] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
path_filename(const char *path)
|
||||||
|
{
|
||||||
|
const char *start = strrchr(path, '/');
|
||||||
|
if (start == NULL)
|
||||||
|
start = path;
|
||||||
|
else
|
||||||
|
start++;
|
||||||
|
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
@ -10,5 +10,6 @@ int path_next(const char *path, char sep, const char (**next));
|
|||||||
int path_keep(char *path, int n);
|
int path_keep(char *path, int n);
|
||||||
int path_strip(const char *path, int n, const char (**next));
|
int path_strip(const char *path, int n, const char (**next));
|
||||||
void path_remove_trailing(char *path);
|
void path_remove_trailing(char *path);
|
||||||
|
const char *path_filename(const char *path);
|
||||||
|
|
||||||
#endif /* PATH_H */
|
#endif /* PATH_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user