BASENAME(3) Library Routines BASENAME(3)
basename, dirname - get components of a pathname
char *basename (const char *path);
char *dirname (const char *path);
basename returns a pointer to the file component of path. If path ends
with a directory separator, then basename returns an empty string.
dirname returns a pointer to an internal buffer containing the direc-
tory component of path, without a trailing directory separator. If
path ends with a directory separator, then that character is the only
part of path not included in the resultant string. If path contains no
directory separator, then the string "." is returned. If path is NULL,
an empty string is returned.
Unlike ExpandPathGS(2), dirname does not expand any GS/OS prefixes that
may be present in path.
Under GS/OS, permissable directory separators are : and /, with the
former taking precedence.
basename is thread-safe; dirname is not.
If path is longer than PATH_MAX characters, dirname will only consider
the first PATH_MAX-1 characters.
Devin Reade <firstname.lastname@example.org>
GNO 29 March 1998 BASENAME(3)
Man(1) output converted with