David Aguilar | e1c0688 | 2009-05-31 01:35:51 -0700 | [diff] [blame] | 1 | #include "../git-compat-util.h" |
2 | |||||
3 | /* Adapted from libiberty's basename.c. */ | ||||
4 | char *gitbasename (char *path) | ||||
5 | { | ||||
6 | const char *base; | ||||
7 | /* Skip over the disk name in MSDOS pathnames. */ | ||||
8 | if (has_dos_drive_prefix(path)) | ||||
9 | path += 2; | ||||
10 | for (base = path; *path; path++) { | ||||
11 | if (is_dir_sep(*path)) | ||||
12 | base = path + 1; | ||||
13 | } | ||||
14 | return (char *)base; | ||||
15 | } |