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 ".".
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.