Open System Services Library Calls Reference Manual (G06.27+, H06.04+)

OSS Library Calls (a - d) dirname(3)
NAME
dirname - Returns the parent directory name of a le pathname
LIBRARY
G-series native OSS processes: /G/system/sysnn/zosshsrl
H-series OSS processes: /G/system/zdllnnn/zosshdll
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 le, and
returns a pointer to the pathname of that les 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 modies 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 le
whose pathname is pointed to by path.
ERRORS
None. This function does nto set errno.
RELATED INFORMATION
Functions: basename(3).
527187-004 Hewlett-Packard Company 179