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