summaryrefslogtreecommitdiff
path: root/compat/basename.c
blob: 9f00421a26c306dbe5e40895594869f21c8405f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "../git-compat-util.h"

/* Adapted from libiberty's basename.c.  */
char *gitbasename (char *path)
{
	const char *base;
	skip_dos_drive_prefix(&path);
	for (base = path; *path; path++) {
		if (is_dir_sep(*path))
			base = path + 1;
	}
	return (char *)base;
}