basename(3C)basename(3C)NAMEbasename(), dirname() - extract components of a path name
takes the path name pointed to by path and returns a pointer to the
final component of the path name, deleting any trailing '/' characters.
If the string consists entirely of '/' characters, returns a pointer to
the string "/". If path is a null pointer or points to the empty
string, returns a pointer to the string ".".
takes the path name pointed to by path and returns a pointer to a
string that is a path name of the parent directory of that file. If
path is a null pointer, points to the empty string, or does not contain
a '/' character, then returns a pointer to the string ".".
returns a pointer to the final component of path.
returns a pointer to a string that is the parent directory of path.
The following code fragment calls and
and may overwrite path.
and in non-threaded applications currently use a static buffer in each
function to hold the result string. Any subsequent calls to and may
overwrite the static buffer. At some release after HP-UX 11i Version
1, HP may use to allocate the buffers. Once allocated, those buffers
will be reused and their addresses will not change; however, if the
fails, and would return "." and would be set to
and were developed by HP.
SEE ALSObasename(1), thread_safety(5).