nofconfig.h
1.92 KB
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
/* Nofrendo Configuration API
**
** This file is in the public domain.
**
** $Id: nofconfig.h,v 1.1 2001/04/27 14:37:11 neil Exp $
*/
#ifndef _CONFIG_H_
#define _CONFIG_H_
#ifndef CONFIG_FILE
#define CONFIG_FILE "nofrendo.cfg"
#endif
typedef struct config_s
{
/* open loads from the disk the saved configuration.
**
** open must be the first config function called.
**
** open returns true on success, false otherwise.
*/
bool (*open)(void);
/* close saves the current configuration to disk.
**
** close must be the last config function called.
*/
void (*close)(void);
/* read_int loads an integer from the configuration into "value"
**
** If the specified "key" does not exist, the "def"ault is returned
*/
int (*read_int)(const char *group, const char *key, int def);
/* read_string copies a string from the configuration into "value"
**
** If the specified "key" does not exist, the "def"ault is returned
*/
const char *(*read_string)(const char *group, const char *key, const char *def);
void (*write_int)(const char *group, const char *key, int value);
void (*write_string)(const char *group, const char *key, const char *value);
char *filename;
} config_t;
extern config_t config;
#endif /* !_CONFIG_H_ */
/*
** $Log: nofconfig.h,v $
** Revision 1.1 2001/04/27 14:37:11 neil
** wheeee
**
** Revision 1.1.1.1 2001/04/27 07:03:54 neil
** initial
**
** Revision 1.5 2000/10/10 13:58:13 matt
** stroustrup squeezing his way in the door
**
** Revision 1.4 2000/07/19 15:58:55 neil
** config file now configurable (ha)
**
** Revision 1.3 2000/07/11 14:59:27 matt
** minor cosmetics.. =)
**
** Revision 1.2 2000/07/11 13:35:38 bsittler
** Changed the config API, implemented config file "nofrendo.cfg". The
** GGI drivers use the group [GGI]. Visual= and Mode= keys are understood.
**
** Revision 1.1 2000/07/11 07:46:11 neil
** Initial commit
**
**
*/