Portability fixes. Mostly for Android.
[pwmd.git] / src / rcfile.h
bloba5844489b6781df9f3db881dca25d3e3fbddf698
1 /*
2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 Ben Kibbey <bjk@luxsci.net>
5 This file is part of pwmd.
7 Pwmd is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
12 Pwmd is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef RCFILE_H
21 #define RCFILE_H
23 #include <pthread.h>
24 #include "util-slist.h"
26 /* This is a string so ealier versions of glib can be used. */
27 #define DEFAULT_ITERATION_PROGRESS "2000"
29 #ifdef HAVE_MLOCKALL
30 int disable_mlock;
31 #endif
32 char *logfile;
33 char *rcfile;
34 char *homedir;
35 int max_recursion_depth;
36 int disable_list_and_dump;
37 struct slist_s *global_config;
38 int log_syslog;
39 pthread_mutex_t rcfile_mutex;
40 pthread_cond_t rcfile_cond;
41 pthread_t rcfile_tid;
43 struct slist_s *config_parse(const char *filename);
44 void config_clear_keys();
45 void config_free(struct slist_s *config);
47 char *config_get_value(const char *section, const char *what);
48 long config_get_long(const char *section, const char *what);
49 unsigned long config_get_ulong(const char *section, const char *what);
50 int config_get_boolean(const char *section, const char *what);
51 int config_get_integer(const char *section, const char *what);
52 char *config_get_string(const char *section, const char *what);
53 char **config_get_list(const char *section, const char *what);
54 long long config_get_longlong(const char *section, const char *what);
55 unsigned long long config_get_ulonglong(const char *section, const char *what);
57 int config_set_list_param(struct slist_s **config, const char *section,
58 const char *name, const char *value);
59 int config_set_int_param(struct slist_s **config, const char *section,
60 const char *name, const char *value);
61 int config_get_int_param(struct slist_s *config, const char *section,
62 const char *name, int *exists);
63 int config_get_bool_param(struct slist_s *config, const char *section,
64 const char *name, int *exists);
65 int config_set_bool_param(struct slist_s **config, const char *section,
66 const char *name, const char *value);
68 #endif