mirror of
https://github.com/swaywm/sway.git
synced 2026-03-03 01:41:03 -05:00
Switch to using a function to parse booleans
This commit is contained in:
parent
224ade1382
commit
863914ec95
15 changed files with 62 additions and 85 deletions
|
|
@ -123,6 +123,21 @@ uint32_t parse_color(const char *color) {
|
|||
return res;
|
||||
}
|
||||
|
||||
bool parse_boolean(const char *boolean, const 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) {
|
||||
return true;
|
||||
} else if (strcmp(boolean, "toggle") == 0) {
|
||||
return !current;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
char* resolve_path(const char* path) {
|
||||
struct stat sb;
|
||||
ssize_t r;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue