util — C Library Procedures
NAME
Util_CanonicalDir − Canonicalize a directory name to a full path.
SYNOPSIS
#include <util.h>
char ∗
Util_CanonicalDir(newDir, currentDir, buffer)
ARGUMENTS
char ∗newDir (in) The new directory name to canonicalize.
char ∗currentDir (in) The current directory (or other name) to which newDir is relative - may be NULL.
char ∗buffer (in/out) Pre-allocated space in which to put new canonicalized name - may be NULL.
DESCRIPTION
The procedure takes a directory name, newDir, and turns it into a full path relative to a directory currentDir. The parameter currentDir can actually be any full pathname to a directory but is usually the current directory. If currentDir is NULL, the procedure calls getwd() to find the full path name to the current directory. If the parameter buffer is NULL, then the procedure allocates space for the new canonicalized directory name and returns a pointer to that new string. If buffer is not NULL, then it must be an area of at least MAXPATHLEN characters in which the procedure will copy the computed canonicalized name. A pointer to buffer is then returned. It is okay for buffer and newDir to be the same physical string, since newDir is only overwritten at the end of the computation.
The procedure returns a pointer to a new full pathname if successful. If there is a failure, it returns NULL, with an error string in buffer if that parameter was non-NULL.
KEYWORDS
directory, path, pathname, full
Sprite version 1.0 — May 03, 1991