1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Linus Nielsen Feltzing
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
28 int type
; /* See TYPE_ macros above */
29 int min
; /* Min value for integers, should be 0 for enums */
30 int max
; /* Max value for enums and integers,
31 buffer size for strings */
32 int *val
; /* Pointer to integer/enum value,
33 NULL if the item is a string */
34 char *name
; /* Pointer to the name of the item */
35 char **values
; /* List of strings for enums, NULL if not enum */
36 char *string
; /* Pointer to a string buffer if the item is a string,
40 void configfile_init(struct plugin_api
* newrb
);
42 /* configfile_save - Given configdata entries this function will
43 create a config file with these entries, destroying any
44 previous config file of the same name */
45 int configfile_save(const char *filename
, struct configdata
*cfg
,
46 int num_items
, int version
);
48 int configfile_load(const char *filename
, struct configdata
*cfg
,
49 int num_items
, int min_version
);
51 /* configfile_get_value - Given a key name, this function will
52 return the integer value for that key.
55 filename = config file filename
56 name = (name/value) pair name entry
58 value if (name/value) pair is found
59 -1 if entry is not found
61 int configfile_get_value(const char* filename
, const char* name
);
63 /* configure_update_entry - Given a key name and integer value
64 this function will update the entry if found, or add it if
68 filename = config file filename
69 name = (name/value) pair name entry
70 val = new value for (name/value) pair
72 1 if the (name/value) pair was found and updated with the new value
73 0 if the (name/value) pair was added as a new entry
76 int configfile_update_entry(const char* filename
, const char* name
, int val
);