Open System Services Library Calls Reference Manual (G06.27+, H06.04+)
basename(3) OSS Library Calls Reference Manual
NAME
basename - Returns the final component of a pathname
LIBRARY
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series OSS processes: /G/system/zdllnnn/zcrtldll
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).
1−28 Hewlett-Packard Company 527187-004