[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 section Program Description Attributes) with the rcfile
or environrc
attributes.
7.10.1 configuration file presets | ||
7.10.2 Saving the presets into a configuration file | ||
7.10.3 Creating a sample configuration file | ||
7.10.4 environment variable presets | ||
7.10.5 Config file only example |
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:
(see section 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.
(see section optionGetValue) will find the first value within the hierarchy with a name that matches the name passed in.
(see section 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.
(see section 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
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Bruce Korb on August 21, 2015 using texi2html 1.82.