summaryrefslogtreecommitdiff
path: root/hw/xfree86/parser/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xfree86/parser/scan.c')
-rw-r--r--hw/xfree86/parser/scan.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index d2e8b6d2b..270dbd5bb 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -1028,3 +1028,33 @@ xf86addComment(char *cur, char *add)
return (cur);
}
+
+Bool
+xf86getBoolValue(Bool *val, const char *str)
+{
+ if (!val || !str)
+ return FALSE;
+ if (*str == '\0') {
+ *val = TRUE;
+ } else {
+ if (strcmp(str, "1") == 0)
+ *val = TRUE;
+ else if (strcmp(str, "on") == 0)
+ *val = TRUE;
+ else if (strcmp(str, "true") == 0)
+ *val = TRUE;
+ else if (strcmp(str, "yes") == 0)
+ *val = TRUE;
+ else if (strcmp(str, "0") == 0)
+ *val = FALSE;
+ else if (strcmp(str, "off") == 0)
+ *val = FALSE;
+ else if (strcmp(str, "false") == 0)
+ *val = FALSE;
+ else if (strcmp(str, "no") == 0)
+ *val = FALSE;
+ else
+ return FALSE;
+ }
+ return TRUE;
+}