/* mkpath - ensure all directories in path exist Algorithm takes the pessimistic view and works top-down to ensure each directory in path exists, rather than optimistically creating the last element and working backwards.  */
int mkpath(const char *path)
/* mkpath - ensure all directories in path exist Algorithm takes the pessimistic view and works top-down to ensure each directory in path exists, rather than optimistically creating the last element and working backwards.  */
int mkpath(const char *path)
{
        if (sp != pp)
        {
            *sp = '\0';
            status = do_mkdir(copypath);
            *sp = '/';
        }
        pp = sp + 1;
    }
    if (status == 0)
        status = do_mkdir(path);
    free(copypath);
    return (status);
}