diff options
author | J. Alexander Treuman <jat@spatialrift.net> | 2006-07-21 17:06:20 +0000 |
---|---|---|
committer | J. Alexander Treuman <jat@spatialrift.net> | 2006-07-21 17:06:20 +0000 |
commit | b892028b9602f0f7922a5406047706eb36454469 (patch) | |
tree | 4e5a10fc6a9004ec725566fa6d2919935dbcf98a /src | |
parent | 74c4f5364df84f7fe7a944a4f690a11766e90f6f (diff) | |
download | mpd-b892028b9602f0f7922a5406047706eb36454469.tar.gz mpd-b892028b9602f0f7922a5406047706eb36454469.tar.xz mpd-b892028b9602f0f7922a5406047706eb36454469.zip |
Add a getBoolConfigParam function
git-svn-id: https://svn.musicpd.org/mpd/trunk@4417 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r-- | src/conf.c | 13 | ||||
-rw-r--r-- | src/conf.h | 2 |
2 files changed, 15 insertions, 0 deletions
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); |