The
basename ();
function
returns the last component from the pathname pointed to by
Fa path ,
deleting any trailing
`/'
characters.
If
Fa path
consists entirely of
`/'
characters, a pointer to the string
Qq /
is returned.
If
Fa path
is a null pointer or the empty string, a pointer to the string
Qq .
is returned.
IMPLEMENTATION NOTES
The
basename ();
function
returns a pointer to internal storage space allocated on the first call
that will be overwritten
by subsequent calls.
RETURN VALUES
On successful completion,
basename ();
returns a pointer to the last component of
Fa path .
If
basename ();
fails, a null pointer is returned and the global variable
errno
is set to indicate the error.
ERRORS
The following error codes may be set in
errno
Bq Er ENAMETOOLONG
The path component to be returned was larger than
MAXPATHLEN