NAME
path - split pathname into directory and file parts
SYNOPSIS
path (pathname,direc,file);
char *pathname,*direc,*file;
DESCRIPTION
Path breaks a complete pathname into a filename part and a
directory part. It handles all pathnames allowed in UNIX.
The
resulting filename will not have trailing slashes, and will
not be
null. The resulting directory name will not be null.
You provide three strings:
pathname, the complete name to be split,
direc, a buffer into which the directory part will be
copied, and
file, a buffer to hold the filename part. You must ensure
that the
buffers are big enough.
The handling of most names is
obvious, but several special cases
exist. The name "f", containing no slashes, is
split into
directory "." and filename "f". The name
"/" is directory "/" and
filename ".". The path "" is directory
"." and filename ".".
SEE ALSO
getwd(3), expand(3)
BUGS
The string direc must be big enough to hold the entire
pathname,
since it is used as working storage by path.
A possible future modification
to path would add the additional
proviso that the directory part will be an absolute
pathname. The
implementation of this is simple -- you perform getwd, and
prepend
the value (with a separating "/"), but only if the
original
pathname is not absolute (i.e. does not begin with
"/"). It is
also possible (but not necessary) to resolve initial
"../"
substrings in pathname at that time.