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 #include <unistd.h>
37 #include <ctype.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 
44 typedef struct _dictionary_ {
45 	/** Number of entries in dictionary */
46 	int n;
47 	/** Storage size */
48 	int size;
49 	/** List of string values */
50 	char **val;
51 	/** List of string keys */
52 	char **key ;
53 	/** List of hash values for keys */
54 	unsigned *hash;
55 } dictionary ;
56 
57 
58 /* generated by genproto */
59 
60 dictionary * iniparser_new(char *ininame);
61 void iniparser_free(dictionary * d);
62 
63 int iniparser_getnsec(dictionary * d);
64 char * iniparser_getsecname(dictionary * d, int n);
65 void iniparser_dump(dictionary * d, FILE * f);
66 void iniparser_dump_ini(dictionary * d, FILE * f);
67 char * iniparser_getkey(dictionary *d, char *section, char *key);
68 char * iniparser_getstr(dictionary * d, char * key);
69 char * iniparser_getstring(dictionary * d, char * key, char * def);
70 int iniparser_getint(dictionary * d, char * key, int notfound);
71 double iniparser_getdouble(dictionary * d, char * key, double notfound);
72 int iniparser_getboolean(dictionary * d, char * key, int notfound);
73 int iniparser_find_entry(dictionary  *   ini, char        *   entry);
74 int iniparser_setstr(dictionary * ini, char * entry, char * val);
75 void iniparser_unset(dictionary * ini, char * entry);
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif
82 
83