1 /*
2  Based upon libiniparser, by Nicolas Devillard
3  Hacked into 1 file (m-iniparser) by Freek/2005
4  Original terms following:
5 
6  -- -
7 
8  Copyright (c) 2000 by Nicolas Devillard (ndevilla AT free DOT fr).
9 
10  Written by Nicolas Devillard. Not derived from licensed software.
11 
12  Permission is granted to anyone to use this software for any
13  purpose on any computer system, and to redistribute it freely,
14  subject to the following restrictions:
15 
16  1. The author is not responsible for the consequences of use of
17  this software, no matter how awful, even if they arise
18  from defects in it.
19 
20  2. The origin of this software must not be misrepresented, either
21  by explicit claim or by omission.
22 
23  3. Altered versions must be plainly marked as such, and must not
24  be misrepresented as being the original software.
25 
26  4. This notice may not be removed or altered.
27 
28  */
29 
30 
31 #ifndef _INIPARSER_H_
32 #define _INIPARSER_H_
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36 #if !defined(WIN32) && !defined(_WIN32)
37 #include <unistd.h>
38 #endif
39 #include <ctype.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 
46 typedef struct _dictionary_ {
47 	/** Number of entries in dictionary */
48 	int n;
49 	/** Storage size */
50 	int size;
51 	/** List of string values */
52 	char **val;
53 	/** List of string keys */
54 	char **key ;
55 	/** List of hash values for keys */
56 	unsigned *hash;
57 } dictionary ;
58 
59 
60 /* generated by genproto */
61 
62 dictionary * iniparser_new(char *ininame);
63 void iniparser_free(dictionary * d);
64 
65 int iniparser_getnsec(dictionary * d);
66 char * iniparser_getsecname(dictionary * d, int n);
67 void iniparser_dump(dictionary * d, FILE * f);
68 void iniparser_dump_ini(dictionary * d, FILE * f);
69 char * iniparser_getkey(dictionary *d, char *section, char *key);
70 char * iniparser_getstr(dictionary * d, char * key);
71 char * iniparser_getstring(dictionary * d, char * key, char * def);
72 int iniparser_getint(dictionary * d, char * key, int notfound);
73 double iniparser_getdouble(dictionary * d, char * key, double notfound);
74 int iniparser_getboolean(dictionary * d, char * key, int notfound);
75 int iniparser_find_entry(dictionary  *   ini, char        *   entry);
76 int iniparser_setstr(dictionary * ini, char * entry, char * val);
77 void iniparser_unset(dictionary * ini, char * entry);
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif
84 
85