diff options
author | Chris Robinson <[email protected]> | 2009-09-15 22:18:13 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-09-15 22:18:13 -0700 |
commit | 49648fe22dec8fb5a783d8a7e3929b3231f6f4f4 (patch) | |
tree | 91476b2a2a76072128fe586400577fadfc179080 /Alc/alcConfig.c | |
parent | 9f037e89802a7b4fc6c287bab97b85050bbd6721 (diff) |
Make a GetConfigValueBool function and use it
Diffstat (limited to 'Alc/alcConfig.c')
-rw-r--r-- | Alc/alcConfig.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Alc/alcConfig.c b/Alc/alcConfig.c index b6e46139..de42f154 100644 --- a/Alc/alcConfig.c +++ b/Alc/alcConfig.c @@ -313,3 +313,12 @@ float GetConfigValueFloat(const char *blockName, const char *keyName, float def) return (float)strtod(val, NULL); #endif } + +int GetConfigValueBool(const char *blockName, const char *keyName, float def) +{ + const char *val = GetConfigValue(blockName, keyName, ""); + + if(!val[0]) return !!def; + return (strcasecmp(val, "true") == 0 || strcasecmp(val, "yes") == 0 || + strcasecmp(val, "on") == 0 || atoi(val) != 0); +} |