Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)

confstr(3) Guardian Native C Library Calls Reference Manual
NAME
confstr - Determines the current value of a specied system variable dened by a string value
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series native Guardian processes: implicit libraries
H-series OSS processes: implicit libraries
SYNOPSIS
#include <unistd.h>
size_t confstr(
int name,
char *buf,
size_t len);
PARAMETERS
name Species the system variable for which information is to be returned. The only
value recognized in the OSS implementation is _CS_PATH, which requests the
value for the PATH environment variable.
buf Points to the buffer into which the confstr function copies the name value.
len Species the size of the buffer to receive the value corresponding to the name
parameter value.
DESCRIPTION
The confstr() function allows an application to determine the current setting of system parame-
ters, limits, or options that are specied by the string value in its name parameter.
If all of the following are true:
The len parameter is not 0 (zero)
The name parameter has a system-dened value
The buf parameter is not a null pointer
then the confstr() function copies that value into a buffer of len bytes pointed to by the buf
parameter.
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 nd 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.
RETURN VALUES
If the value specied by the name parameter is system-dened, the confstr() function returns the
size of the buffer needed to hold the entire value. If this return value is greater than the specied
len value, the string returned as the buf value is truncated.
If the value of the len parameter is 0 (zero) or the buf value is NULL, the confstr() function
returns the size of the buffer needed to hold the entire system-dened value, but does not copy
the string value.
136 Hewlett-Packard Company 527192-005