Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ confstr(3C) — SunOS 5.6

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

pathconf(2)

sysconf(3C)

attributes(5)

confstr(3C)

NAME

confstr − get configurable variables

SYNOPSIS

#include <unistd.h>

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

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.  confstr() supports the following values for name, defined in <unistd.h>:

_CS_LFS_CFLAGS _CS_LFS64_CFLAGS
_CS_LFS_LDFLAGS _CS_LFS64_LDFLAGS
_CS_LFS_LIBS _CS_LFS64_LIBS
_CS_LFS_LINTFLAGS _CS_LFS64_LINTFLAGS
_CS_PATH

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. 

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
MT-Level Mt-Safe

SEE ALSO

pathconf(2), sysconf(3C), attributes(5)

SunOS 5.6  —  Last change: 29 Dec 1996

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026