From b892028b9602f0f7922a5406047706eb36454469 Mon Sep 17 00:00:00 2001 From: "J. Alexander Treuman" Date: Fri, 21 Jul 2006 17:06:20 +0000 Subject: Add a getBoolConfigParam function git-svn-id: https://svn.musicpd.org/mpd/trunk@4417 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/conf.c | 13 +++++++++++++ src/conf.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/conf.c b/src/conf.c index 77dafbbcf..2a5ea9e5f 100644 --- a/src/conf.c +++ b/src/conf.c @@ -362,6 +362,19 @@ char *getConfigParamValue(char *name) return param->value; } +int getBoolConfigParam(char *name) +{ + ConfigParam *param; + + param = getConfigParam(name); + if (!param) return -1; + + if (strcmp("yes", param->value) == 0) return 1; + else if (strcmp("no", param->value) == 0) return 0; + + return -1; +} + BlockParam *getBlockParam(ConfigParam * param, char *name) { BlockParam *ret = NULL; diff --git a/src/conf.h b/src/conf.h index 5e86d1bc5..fd68ca327 100644 --- a/src/conf.h +++ b/src/conf.h @@ -85,6 +85,8 @@ ConfigParam *getNextConfigParam(char *name, ConfigParam * last); char *getConfigParamValue(char *name); +int getBoolConfigParam(char *name); + BlockParam *getBlockParam(ConfigParam * param, char *name); ConfigParam *parseConfigFilePath(char *name, int force); -- cgit v1.2.3