_NutConfStr()

interface to confstr 

Function


SYNOPSIS

#include <nutc.h>

size_t _NutConfStr(int name, char *buf, size_t len, int fmt);


DESCRIPTION

The _NutConfStr() function is an interface to the confstr() function which allows the caller to specify the format for the returned path. Refer to confstr() for information on the available configuration variables that can be queried.

If len is not zero and if name has a configuration-defined value, _NutConfStr() copies that value into the len-byte buffer that buf points to. If the string to be returned is longer than len bytes, including the terminating null character, _NutConfStr() truncates the string to len-1 bytes and null-terminates the result. To determine if the string was truncated, compare the value that _NutConfStr() returns with len.

If len is zero and buf is NULL, _NutConfStr() still returns the integer value but does not return a string.


PARAMETERS

name 

Specifies the system variable to be queried. Refer to the confstr() reference page for more information.

buf 

Points to the buffer where len-byte values are stored.

len 

Is the length of the string.

fmt 

Can be one of the following:

NUTFMT_WIN32 

Indicates that the path should be returned in Windows format.

NUTFMT_NUTC 

Indicates that the path should be returned in NuTCRACKER Platform format.

NUTFMT_WIN32_FS 

Indicates that the path should be returned in Windows format, using forward slashes (also known as MKS format).


RETURN VALUES

If name does not have a configuration-defined value, _NutConfStr() returns a value of zero and does not change errno. If name has a configuration-defined value, _NutConfStr() returns the size of buffer that would be needed to hold the entire configuration-defined value. If this return value is greater than len, the string returned in bufhas been truncated. On failure, _NutConfStr() fails if name is invalid, returning zero and setting errno to EINVAL.


CONFORMANCE

PTC MKS Toolkit UNIX APIs extension.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
_NutPathToNutc(), _NutPathToWin32(), _NutPathToWin32FS(), _NutQueryRootDir(), _NutQueryWinDir(), _NutQueryWinNetFileDir(), _NutQueryWinSysDir(), confstr(), fpathconf(), pathconf(), sysconf()


PTC MKS Toolkit 10.4 Documentation Build 39.