In the source standard, basename() is implemented as a macro causing it to behave as described in ISO POSIX (2003), and is equivalent to the function __xpg_basename(). If the macro is undefined, basename() from the binary standard is used, with differences as described here:
The string identified by path shall not be modified.
If path is "/", or ends with a trailing '/' character, the basename() function shall return a pointer to an empty string.
On success, the basename() function shall return a pointer to the final component of path. Otherwise, it shall return a null pointer.