1 /*
2  *	Copyright (c) 2006 Eduard Bloch
3  *
4  *	Config parsing code, with interface similar to basic libdeflt interface
5  *	from J.  Schilling but with different semantics
6  *
7  *	get_value uses a static buffer (warning, non-reentrant)
8  *	cfg_open and cfg_close maintain a static FILE pointer (warning, non-reentrant)
9  *
10  */
11 /*
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License version 2
14  * as published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along with
22  * this program; see the file COPYING.  If not, write to the Free Software
23  * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24  */
25 
26 #ifndef	_DEFLTS_H
27 #define	_DEFLTS_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 /* FIXME: use inline trough an INLINE macro wrapper */
34 extern int	cfg_open	(const char *name);
35 extern int	cfg_close	(void);
36 
37 /* reset the position in FILE */
38 extern void	cfg_restart	(void);
39 /* returns the next value found after the current position */
40 extern char	*cfg_get_next	(const char *name);
41 /* equivalent to cfg_restart(); cfg_get_next(...) */
42 extern char *cfg_get(const char *key);
43 /* function wrapped by those above */
44 extern char *get_value(FILE *srcfile, const char *key, int dorewind);
45 
46 #ifdef	__cplusplus
47 }
48 #endif
49 
50 #endif
51