Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
confstr - get string value of system variable
&pagelevel(4)&pagelevel
Syntax | #include <unistd.h> size_t confstr(int name, char *buf, size_t len); |
Description | confstr() provides a method of obtaining the current string values of a configurable system variable. Its use and purpose are similar to sysconf() , but it is used where string values rather than numeric values are returned.
The implementation supports only value of _CS_PATH , defined in unistd.h , for name. 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 byte, 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 a string. If len is 0 but buf is not a null pointer, the result is unspecified. |
Return val. | Buffer size for the value of name |
|
| if name has a configuration-defined value. If this return value is longer than len, the string returned in buf is truncated. |
| 0 | if name does not have a configuration-defined value. errno is not set. if name has an invalid value. errno is set to indicate the error. |
Errors | confstr() will fail if:
EINVAL The value of the name argument is invalid.
|
Notes | An application can distinguish between an invalid name parameter value and one that corresponds to a configurable environment variable that has no configuration-defined value by checking if errno is modified. This mirrors the behavior of sysconf() . confstr() was originally needed as a way of finding the configuration-defined default value for the environment variable PATH . Since PATH can be extended by the user, applications need a way to determine the system-supplied PATH environment variable value that contains the correct search path for the XPG4 commands.
|
See also | sysconf() , pathconf() , unistd.h .
|