summaryrefslogtreecommitdiff
path: root/compat/basename.c
blob: d8f8a3c6dc039ff8891d04857be737b29259d7c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "../git-compat-util.h"
 
/* Adapted from libiberty's basename.c.  */
char *gitbasename (char *path)
{
	const char *base;
	/* Skip over the disk name in MSDOS pathnames. */
	if (has_dos_drive_prefix(path))
		path += 2;
	for (base = path; *path; path++) {
		if (is_dir_sep(*path))
			base = path + 1;
	}
	return (char *)base;
}