diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-07-23 21:37:53 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-07-23 21:37:53 -0400 |
commit | 9ec1d6cf79e6f9c3233f577c6fddeaeb21bb1bfc (patch) | |
tree | bfc136252f81a5350f240c20161d2d0bfc2f80dd /common | |
parent | Remove unneeded const (diff) | |
download | sway-9ec1d6cf79e6f9c3233f577c6fddeaeb21bb1bfc.tar.gz sway-9ec1d6cf79e6f9c3233f577c6fddeaeb21bb1bfc.tar.zst sway-9ec1d6cf79e6f9c3233f577c6fddeaeb21bb1bfc.zip |
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) { | |||
124 | } | 124 | } |
125 | 125 | ||
126 | bool parse_boolean(const char *boolean, bool current) { | 126 | bool parse_boolean(const char *boolean, bool current) { |
127 | if (strcmp(boolean, "1") == 0 | 127 | if (strcasecmp(boolean, "1") == 0 |
128 | || strcmp(boolean, "yes") == 0 | 128 | || strcasecmp(boolean, "yes") == 0 |
129 | || strcmp(boolean, "on") == 0 | 129 | || strcasecmp(boolean, "on") == 0 |
130 | || strcmp(boolean, "true") == 0 | 130 | || strcasecmp(boolean, "true") == 0 |
131 | || strcmp(boolean, "enable") == 0 | 131 | || strcasecmp(boolean, "enable") == 0 |
132 | || strcmp(boolean, "enabled") == 0 | 132 | || strcasecmp(boolean, "enabled") == 0 |
133 | || strcmp(boolean, "active") == 0) { | 133 | || strcasecmp(boolean, "active") == 0) { |
134 | return true; | 134 | return true; |
135 | } else if (strcmp(boolean, "toggle") == 0) { | 135 | } else if (strcasecmp(boolean, "toggle") == 0) { |
136 | return !current; | 136 | return !current; |
137 | } | 137 | } |
138 | // All other values are false to match i3 | ||
138 | return false; | 139 | return false; |
139 | } | 140 | } |
140 | 141 | ||