Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ confstr(3) — OSF/1 3.0 αXP

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

pathconf(3)

sysconf(3)

confstr(3)  —  Subroutines

NAME

confstr − Determines the current value of a specified system variable defined by a string value

LIBRARY

Standard C library (libc.a)

SYNOPSIS

#include <unistd.h> size_t confstr(
int name,
char ∗buf,
size_t len);

PARAMETERS

nameSpecifies the system variable setting to be returned. Valid values for the name parameter are defined in the unistd.h header file. 

bufPoints to the buffer into which the confstr function copies the name value. 

lenSpecifies the size of the buffer storing the name value. 

DESCRIPTION

The confstr() function allows an application to determine the current setting of certain system parameters, limits, or options that are defined by a string value. The function is mainly used by applications to find the system default value for the PATH environment variable. 

If the following conditions are true, then the confstr() function copies that value into a len-byte buffer pointed to by the buf parameter:

       •The len parameter is not 0 (zero)

       •The name parameter has a system-defined value

       •The buf parameter is not a null pointer

If the string to be returned is longer than len bytes, including the terminating null, then the confstr() function truncates the string to len-1 bytes and adds a terminating null to the result. The application can detect that the string was truncated by comparing the value returned by the confstr() function with the value of the len parameter. 

EXAMPLES

To find out how big a buffer is needed to store the string value of name, enter:

confstr(_CS_PATH, NULL, (size_t) 0)

The confstr() function returns the size of the buffer necessary. 

FILES

limits.hContains system-defined limits. 

unistd.hContains system-defined environment variables. 

RETURN VALUES

If the value specified by the name parameter is system-defined, the confstr() function returns the size of the buffer needed to hold the entire value.  If this return value is greater than the specified len value, the string returned as the buf value is truncated. 

If the value of the len parameter is set to 0 (zero) or the buf value is NULL, the confstr() function returns the size of the buffer needed to hold the entire system-defined value, but does not copy the string value. 

ERRORS

If the specified name value does not have a system-defined value, the confstr() function returns a value of 0 (zero) and leaves the errno global variable unchanged. 

If the specified name value is invalid, a value of 0 (zero) is returned, and the errno global variable is set to EINVAL. 

RELATED INFORMATION

Functions: pathconf(3), sysconf(3). 

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