diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2018-07-23 21:37:53 -0400 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2018-07-23 21:37:53 -0400 |
| commit | dbcd1b2a0eea3bdf6820b85e80d3f33d92934993 (patch) | |
| tree | bfc136252f81a5350f240c20161d2d0bfc2f80dd /common | |
| parent | 9151af222014f2bd7380251c3f1be917da85c0a1 (diff) | |
Address review comments on parse_boolean
Diffstat (limited to 'common')
| -rw-r--r-- | common/util.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/common/util.c b/common/util.c index 3fa0c03f..467aa4b5 100644 --- a/common/util.c +++ b/common/util.c @@ -124,17 +124,18 @@ uint32_t parse_color(const char *color) { } bool parse_boolean(const char *boolean, bool current) { - if (strcmp(boolean, "1") == 0 - || strcmp(boolean, "yes") == 0 - || strcmp(boolean, "on") == 0 - || strcmp(boolean, "true") == 0 - || strcmp(boolean, "enable") == 0 - || strcmp(boolean, "enabled") == 0 - || strcmp(boolean, "active") == 0) { + if (strcasecmp(boolean, "1") == 0 + || strcasecmp(boolean, "yes") == 0 + || strcasecmp(boolean, "on") == 0 + || strcasecmp(boolean, "true") == 0 + || strcasecmp(boolean, "enable") == 0 + || strcasecmp(boolean, "enabled") == 0 + || strcasecmp(boolean, "active") == 0) { return true; - } else if (strcmp(boolean, "toggle") == 0) { + } else if (strcasecmp(boolean, "toggle") == 0) { return !current; } + // All other values are false to match i3 return false; } |
