The basename function takes the UNIX style pathname pointed to by path and returns a pointer to the pathname's final component, deleting any trailing slash (/) characters. If path consists entirely of the slash (/) character, the function returns a pointer to the string "/". If path is a NULL pointer or points to an empty string, the function returns a pointer to the string ".". The basename function can modify the string pointed to by path.