[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    confstr(3C) manual page Table of Contents

Name

confstr - get configurable variables

Synopsis

#include <unistd.h>

size_t confstr(int name, char *buf, size_t len);

MT-Level

Mt-Safe

Description

The confstr() function provides a method for applications to get configuration-defined string values. Its use and purpose are similar to the sysconf(3C) function, but it is used where string values rather than numeric values are returned.

The name argument represents the system variable to be queried. The implementation supports the name value of _CS_PATH , defined in <unistd.h>. It may support others.

If len is not 0, and if name has a configuration-defined value, confstr() copies that value into the len-byte buffer pointed to by buf. If the string to be returned is longer than len bytes, including the terminating null, then confstr() truncates the string to len-1 bytes and null-terminates the result. The application can detect that the string was truncated by comparing the value returned by confstr() with len.

If len is 0, and buf is a null pointer, then confstr() still returns the integer value as defined below, but does not return the string. If len is 0 but buf is not a null pointer, the result is unspecified.

Return Values

If name has a configuration-defined value, the confstr() function 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 buf is truncated.

If name is invalid, confstr() returns 0 and sets errno to indicate the error.

If name does not have a configuration-defined value, confstr() returns 0 and leaves errno unchanged.

Errors

The confstr() function will fail if:
EINVAL
The value of the name argument is invalid.

See Also

pathconf(2) , sysconf(3C)


Table of Contents