The dirname function takes a pointer to a character string that
contains a UNIX pathname and returns a pointer to a string that
is a pathname of the parent directory of that file. Trailing
slash (/) characters in the path are not counted as part of the
path.
This function returns a pointer to the string "." (dot), when the
path argument:
o Does not contain a slash (/).
o Is a NULL pointer.
o Points to an empty string.
The dirname function can modify the string pointed to by the path
argument.
The dirname and basename functions together yield a complete
pathname. The expression dirname(path) obtains the pathname of
the directory where basename(path) is found.
See also basename.