Add to git.
[rws.git] / cfg.h
1 /* Configuration file parsing.
2  * - by Richard W.M. Jones <rich@annexia.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the Free
16  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  *
18  * $Id: cfg.h,v 1.3 2001/03/24 17:26:28 rich Exp $
19  */
20
21 #ifndef CFG_H
22 #define CFG_H
23
24 #include <hash.h>
25
26 /* Reread the configuration file. */
27 extern void cfg_reread_config (const char *path);
28
29 /* If there is host matching HOST, return an opaque pointer to the host's
30  * configuration data.
31  */
32 extern void *cfg_get_host (const char *host);
33
34 /* If there is an alias exactly matching PATH for host HOST_PTR, return
35  * an opaque pointer to the alias's configuration data.
36  */
37 extern void *cfg_get_alias (void *host_ptr, const char *path);
38
39 /* Return the configuration string named KEY.
40  *
41  * HOST_PTR and ALIAS_PTR may be optionally given to narrow the search
42  * down to a particular host/alias combination.
43  *
44  * If the configuration string named KEY cannot be found, then DEFAULT_
45  * VALUE is returned instead.
46  */
47 extern const char *cfg_get_string (void *host_ptr, void *alias_ptr,
48                                    const char *key,
49                                    const char *default_value);
50
51 /* Similar to CFG_GET_STRING but the string is converted to an integer.
52  */
53 extern int cfg_get_int (void *host_ptr, void *alias_ptr,
54                         const char *key, int default_value);
55
56 /* Similar to CFG_GET_STRING but the string is converted to a boolean.
57  */
58 extern int cfg_get_bool (void *host_ptr, void *alias_ptr,
59                          const char *key, int default_value);
60
61 #endif /* CFG_H */