AutoOpts supports the notion of presetting the value or state of an
option. The values may be obtained either from environment variables or from
configuration files (rc or ini files). In order to take
advantage of this, the AutoOpts client program must specify these features in
the option descriptor file (see program attributes) with the rcfile
or environrc attributes.
It is also possible to configure your program without using
the command line option parsing code. This is done by using
only the following four functions from the libopts library:
‘configFileLoad’
(see libopts-configFileLoad) will parse the contents of a config
file and return a pointer to a structure representing the hierarchical
value. The values are sorted alphabetically by the value name and all
entries with the same name will retain their original order.
Insertion sort is used.
‘optionGetValue’
(see libopts-optionGetValue) will find the first value within the
hierarchy with a name that matches the name passed in.
‘optionNextValue’
(see libopts-optionNextValue) will return the next value that
follows the value passed in as an argument. If you wish to get all
the values for a particular name, you must take note when the name
changes.
‘optionUnloadNested’
(see libopts-optionUnloadNested). The pointer passed in must be
of type, OPARG_TYPE_HIERARCHY (see the autoopts/options.h
header file). configFileLoad will return a tOptionValue
pointer of that type. This function will release all the associated
memory. AutoOpts generated code uses this function for its own
needs. Client code should only call this function with pointers
gotten from configFileLoad.