HP 3000 Manuals

confstr [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation


MPE/iX Developer's Kit Reference Manual Volume I

confstr 

Determine string-valued system configuration options. 

Syntax 

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

Parameters 

name             Specifies the system configuration option, the string
                 value of which you want to obtain.  The value of name
                 may be any one of a set of symbols defined in
                 <unistd.h>; each of these symbols corresponds to a
                 system configuration option.  Possible symbols are:

                 _CS_PATH   This name is used to return a value for the
                            PATH environment variable that can find all
                            the POSIX.2 standard utilities.

                 _CS_SHELL  This name is used to find the path name to
                            the standard shell command line interpreter.

buf              Points to the region of memory where confstr() stores
                 the string value of the variable indicated by name.

len              Is the maximum number of characters that can be placed
                 in buf.  If this is not enough to hold the complete
                 string value of name, confstr() truncates the string
                 value to len-1 characters and appends a null terminator
                 (the \0 character).

Return Values 

The confstr() function returns configuration-defined string values.

If name is not a configuration defined value, then confstr() returns 0
and sets errno.

Description 

confstr() is for options that have a string value; for options with a
numeric value, use sysconf().  Unless there is an error, confstr()
returns the length of the configuration defined string, including the
null termination character.  This may be greater than len if len wasn't
big enough to hold the entire string value.

If len is zero and buf is a NULL pointer, confstr() does not attempt to
return a string but does return the appropriate length.  In this way, you
can use the value to allocate sufficient memory to hold the string.

Errors 

If an error occurs, errno is set to one of the following values:

EINVAL            CAUSE           The value specified for the name argument was
                                  invalid.
                  ACTION          Specify a valid name.

If name has a configuration defined value, confstr() returns the size of
the buffer required to hold that value.  If this return value is greater
than len, confstr() truncates the string returned in buf.

See Also 

sysconf(), POSIX.2



MPE/iX 5.0 Documentation