|
FDOSTUI
FreeDOS Text User Interface
|
A configuration file (INI) reader. More...
Go to the source code of this file.
Classes | |
| struct | ini_tuple |
| holds key/value pair data More... | |
| struct | ini_section |
| container to hold data for a section More... | |
| struct | ini |
| container to hold sections More... | |
Enumerations | |
| enum | ini_options { INI_OPTION_NONE = (0<<1) } |
| place holder for future parsing options More... | |
Functions | |
| int | ini_assign (struct ini *const o_ini) |
| initialize ini object More... | |
| void | ini_discharge (struct ini *const io_ini) |
| release resources held by the object More... | |
| char const * | ini_lookup (int *const o_found, struct ini *const i_ini, char const *i_section, char const *i_key) |
| lookup a value More... | |
| int | ini_parse (struct ini *const io_ini, char const *i_path, enum ini_options const i_options) |
| read an INI file More... | |
A configuration file (INI) reader.
Keys not contained in a section are placed in a section named 'defaults.'
Comment lines start with a semi-colon (;) or hash ('#') symbol. These lines are ignored.
Sections and keys are converted to lower case.
Duplicate sections are combined into one.
Duplicate keys will have their value replaced.
Example:
The 'defaults' section will contain two keys: (1) name and (2) foo.
The 'other' section will contain one key: (1) foo.
Following is an example on how to read key/value pairs from an INI file.
| enum ini_options |
| int ini_assign | ( | struct ini *const | o_ini | ) |
initialize ini object
| [out] | o_ini | object to initialize |
Upon failure, it is not advisable to use other routines.
| void ini_discharge | ( | struct ini *const | io_ini | ) |
release resources held by the object
| [in,out] | io_ini | object to release |
| char const * ini_lookup | ( | int *const | o_found, |
| struct ini *const | i_ini, | ||
| char const * | i_section, | ||
| char const * | i_key | ||
| ) |
lookup a value
| [out] | o_found | indicator if key exists |
| [in] | i_ini | valid ini object |
| [in] | i_section | name of section |
| [in] | i_key | name of key |
Zero is a valid return value. Check o_found to see if the key exists.
| int ini_parse | ( | struct ini *const | io_ini, |
| char const * | i_path, | ||
| enum ini_options const | i_options | ||
| ) |
read an INI file
| [in,out] | io_ini | valid ini object |
| [in] | i_path | file to load |
| [in] | i_options | (place holder for future options) |
When an error is encountered, this routine will print a diagnostic message to stderr.
1.8.14