mirror of
https://github.com/labwc/labwc.git
synced 2026-04-11 08:21:13 -04:00
src/common/parse-bool.c: support on/off boolean values
This commit is contained in:
parent
bd6efe4849
commit
2fc500168a
2 changed files with 10 additions and 0 deletions
|
|
@ -94,6 +94,12 @@ Elements at the same level can have the same name whereas attributes cannot.
|
||||||
Therefore, where multiple objects of the same kind are required (for example
|
Therefore, where multiple objects of the same kind are required (for example
|
||||||
*<action>* and *<keybind>*) the top-node of the object has to be an element.
|
*<action>* and *<keybind>*) the top-node of the object has to be an element.
|
||||||
|
|
||||||
|
## BOOLEANS
|
||||||
|
|
||||||
|
Note that in this manual, Boolean values are listed as [yes|no] for simplicity,
|
||||||
|
but it's also possible to use [true|false] and\/or [on|off];
|
||||||
|
this is for compatibility with Openbox.
|
||||||
|
|
||||||
## CORE
|
## CORE
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,14 @@ parse_bool(const char *str, int default_value)
|
||||||
return true;
|
return true;
|
||||||
} else if (!strcasecmp(str, "true")) {
|
} else if (!strcasecmp(str, "true")) {
|
||||||
return true;
|
return true;
|
||||||
|
} else if (!strcasecmp(str, "on")) {
|
||||||
|
return true;
|
||||||
} else if (!strcasecmp(str, "no")) {
|
} else if (!strcasecmp(str, "no")) {
|
||||||
return false;
|
return false;
|
||||||
} else if (!strcasecmp(str, "false")) {
|
} else if (!strcasecmp(str, "false")) {
|
||||||
return false;
|
return false;
|
||||||
|
} else if (!strcasecmp(str, "off")) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
error_not_a_boolean:
|
error_not_a_boolean:
|
||||||
wlr_log(WLR_ERROR, "(%s) is not a boolean value", str);
|
wlr_log(WLR_ERROR, "(%s) is not a boolean value", str);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue