blob: 8ff617cfad3ccae747d8fe639c639d75004e8164 (
plain)
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
|
#include <stdlib.h>
#include <string.h>
#include "triton_p.h"
#include "conf_file.h"
#include "memdebug.h"
static struct conf_file_sect_t *sect=NULL;
static const char* find_option(const char *name)
{
struct option_t *opt;
if (!sect)
{
sect=conf_file_get_section("options");
if (!sect) return 0;
}
list_for_each_entry(opt,§->items,entry)
{
if (strcmp(opt->name,name)==0)
return opt->val;
}
return NULL;
}
int triton_get_int_option(const char *str)
{
const char *val=find_option(str);
if (!val) return 0;
return atoi(val);
}
const char* triton_get_str_option(const char *str)
{
const char *val=find_option(str);
return val;
}
double triton_get_double_option(const char *str)
{
const char *val=find_option(str);
if (!val) return 0;
return atof(val);
}
|