Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

dirname(3) OSS Library Calls Reference Manual
NAME
dirname - Returns the parent directory name of a file pathname
LIBRARY
G-series native OSS processes: /G/system/sysnn/zosshsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zosshdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yosshdll |
SYNOPSIS
#include <libgen.h>
char *dirname(char *path);
PARAMETERS
path Is a pointer to a pathname.
DESCRIPTION
The dirname( ) function takes the path parameter, which points to the pathname of a file, and
returns a pointer to the pathname of that file’s parent directory. Trailing slashes (/) are not
counted as part of the pathname.
In the following situations, the dirname( ) function returns a pointer to the string ".":
The pathname pointed to by path does not contain a slash.
path is a null pointer.
path points to an empty string.
The dirname( ) function can be called by native processes only.
EXAMPLES
"Input String Output String"
/usr/lib/ /usr
/usr/ /
usr .
//
..
.. .
CAUTIONS
The dirname( ) function modifies the string pointed to by the path parameter to create the string
to which the functions return value points.
RETURN VALUES
The dirname( ) function returns a pointer to the pathname of the parent directory of the file
whose pathname is pointed to by path.
ERRORS
None. This function does not set errno.
RELATED INFORMATION
Functions: basename(3).
1188 Hewlett-Packard Company 527187-017