1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Linus Nielsen Feltzing
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
31 int type
; /* See TYPE_ macros above */
32 int min
; /* Min value for integers, should be 0 for enums */
33 int max
; /* Max value for enums and integers,
34 buffer size for strings */
40 }; /* Pointer to value, a union of the possible types */
41 char *name
; /* Pointer to the name of the item */
42 char **values
; /* List of strings for enums, NULL if not enum */
45 /* configfile_save - Given configdata entries this function will
46 create a config file with these entries, destroying any
47 previous config file of the same name */
48 int configfile_save(const char *filename
, struct configdata
*cfg
,
49 int num_items
, int version
);
51 int configfile_load(const char *filename
, struct configdata
*cfg
,
52 int num_items
, int min_version
);
54 /* configfile_get_value - Given a key name, this function will
55 return the integer value for that key.
58 filename = config file filename
59 name = (name/value) pair name entry
61 value if (name/value) pair is found
62 -1 if entry is not found
64 int configfile_get_value(const char* filename
, const char* name
);
66 /* configure_update_entry - Given a key name and integer value
67 this function will update the entry if found, or add it if
71 filename = config file filename
72 name = (name/value) pair name entry
73 val = new value for (name/value) pair
75 1 if the (name/value) pair was found and updated with the new value
76 0 if the (name/value) pair was added as a new entry
79 int configfile_update_entry(const char* filename
, const char* name
, int val
);