Ns_Pathname(3)

Ns_Pathname3

Pathname procedures

Usage

#include "ns.h"

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

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

int
Ns_PathIsAbsolute(char *path)

    


    

Overview

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

Keywords

Releases

Unchanged in 2 releases since Debian 3.1 (Sarge).

  1. 3.1–4.0

From aolserver4 4.0.10-7 in Debian 4.0 (Etch). Parsed by carta from the page's man source.