[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.9 Configuring your program

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.

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 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.

`optionGetValue'

(see section optionGetValue) will find the first value within the hierarchy with a name that matches the name passed in.

`optionNextValue'

(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.

`optionUnloadNested'

(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 September, 30 2006 using texi2html 1.76.

Viewable With Any Browser   autogen Home