diff options
-rw-r--r-- | src/conf.c | 10 | ||||
-rw-r--r-- | src/conf.h | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/conf.c b/src/conf.c index 10d0f9d31..885da1f29 100644 --- a/src/conf.c +++ b/src/conf.c @@ -418,6 +418,16 @@ int getBoolConfigParam(const char *name, int force) return ret; } +bool config_get_bool(const char *name, bool default_value) +{ + int value = getBoolConfigParam(name, true); + + if (value == CONF_BOOL_UNSET) + return default_value; + + return value; +} + int getBoolBlockParam(ConfigParam *param, const char *name, int force) { int ret; diff --git a/src/conf.h b/src/conf.h index e5875d9b7..14cc883b9 100644 --- a/src/conf.h +++ b/src/conf.h @@ -19,6 +19,8 @@ #ifndef MPD_CONF_H #define MPD_CONF_H +#include <stdbool.h> + #define CONF_MUSIC_DIR "music_directory" #define CONF_PLAYLIST_DIR "playlist_directory" #define CONF_DB_FILE "db_file" @@ -97,6 +99,8 @@ ConfigParam *parseConfigFilePath(const char *name, int force); int getBoolConfigParam(const char *name, int force); +bool config_get_bool(const char *name, bool default_value); + int getBoolBlockParam(ConfigParam *param, const char *name, int force); #endif |