Ns_Pathname(3)

NAME
Ns_MakePath, Ns_NormalizePath, Ns_PathIsAbsolute - Pathname procedures

SYNOPSIS
#include "ns.h"

char *
Ns_MakePath(Ns_DString *dest, ...)

char *
Ns_NormalizePath(Ns_DString *dsPtr, char *path)

int
Ns_PathIsAbsolute(char *path)

DESCRIPTION

These functions operate on file pathnames. They work with Unix and Windows pathnames on their respective hosts.

Ns_MakePath(dest, ...)
    Construct a path name from a list of path elements. The Ns_MakePath function constructs a path name by appending a list of path elements to the given Ns_DString. The path elements are separated by single slashes, and the resulting path name is appended to the given Ns_DString. The last argument needs to be NULL to indicate the end of the argument list.

Ns_NormalizePath(dsPtr, path)
    Normalize a path name. This function removes any extraneous slashes from the path and resolves "." and ".." references. The result is appended to the given Ns_DString. The following code appends "/dog" to the Ns_DString: Ns_NormalizePath(&ds,
        "/dog/cat/../../rat/../../dog//mouse/..");

Ns_PathIsAbsolute(path)
    Check for an absolute path name. Return NS_TRUE if the path is absolute and NS_FALSE otherwise. Under Unix, an absolute path starts with a "/". On Windows, it starts with a drive letter followed immediately by a ":".

SEE ALSO
nsd(1), info(n)

KEYWORDS