Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
OSS Library Calls (a - d) basename(3)
NAME
basename - Returns the final component of a pathname
LIBRARY
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <libgen.h>
char *basename(char *path);
PARAMETERS
path is a pointer to a pathname.
DESCRIPTION
The basename( ) function returns a pointer to the final component of the pathname pointed to by
the path parameter. Any slash (/) characters are deleted.
The basename( ) function can be called by native processes only.
If the pathname pointed to by path contains only slashes, basename( ) returns a pointer to the
string "/".
If the path parameter is a null pointer or it points to an empty string, basename( ) returns a
pointer to the string ".".
EXAMPLES
Input String Output String
/usr/lib lib
/usr/ usr
//
CAUTIONS
The basename( ) function may modify the string pointed to by the path parameter.
RETURN VALUES
The basename( ) function returns a pointer to the final component of the pathname pointed to by
path.
ERRORS
None.
RELATED INFORMATION
Functions: dirname(3).
527187-017 Hewlett-Packard Company 1−55