liblcf
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ini.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define INI_ALLOW_MULTILINE   1
 

Functions

int ini_parse (const char *filename, int(*handler)(void *user, const char *section, const char *name, const char *value), void *user)
 

Macro Definition Documentation

#define INI_ALLOW_MULTILINE   1

Nonzero to allow multi-line value parsing, in the style of Python's ConfigParser. If allowed, ini_parse() will call the handler with the same name for each subsequent line parsed.

Definition at line 66 of file ini.h.

Function Documentation

int ini_parse ( const char *  filename,
int(*)(void *user, const char *section, const char *name, const char *value)  handler,
void *  user 
)

Parse given INI-style file. May have [section]s, name=value pairs (whitespace stripped), and comments starting with ';' (semicolon). Section is "" if name=value pair parsed before any section heading.

For each name=value pair parsed, call handler function with given user pointer as well as section, name, and value (data only valid for duration of handler call). Handler should return nonzero on success, zero on error.

Returns
0 on success, line number of first error on parse error (doesn't stop on first error), or -1 on file open error.