summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-03-23 00:52:01 +0000
committerDana Jansens <danakj@orodu.net>2003-03-23 00:52:01 +0000
commitd8268296fb82a0395e1bceadfc1ab196f488f955 (patch)
tree9714ba9451bddfe217134fc65ec2b7cc9856c59e
parent9ff6ea27b193bde39b79ff465cbae699f4322afa (diff)
better parsing errors
-rw-r--r--openbox/config.c7
-rw-r--r--openbox/cparse.l6
2 files changed, 7 insertions, 6 deletions
diff --git a/openbox/config.c b/openbox/config.c
index a6114b47..3a5a1c60 100644
--- a/openbox/config.c
+++ b/openbox/config.c
@@ -89,13 +89,12 @@ gboolean config_set(char *name, ConfigValueType type, ConfigValue value)
gboolean ret = FALSE;
name = g_ascii_strdown(name, -1);
- g_message("Setting %s", name);
/*g_datalist_foreach(&config_def, print_config, NULL);*/
def = g_datalist_get_data(&config_def, name);
if (def == NULL) {
- g_message("Invalid config option '%s'", name);
+ g_warning("Invalid config option '%s'", name);
} else {
if (def->hasList) {
gboolean found = FALSE;
@@ -111,10 +110,12 @@ gboolean config_set(char *name, ConfigValueType type, ConfigValue value)
} while ((it = it->next));
if (!found)
- g_message("Invalid value '%s' for config option '%s'",
+ g_warning("Invalid value '%s' for config option '%s'",
value.string, name);
else
ret = TRUE;
+ } else if (type != def->type) {
+ g_warning("Incorrect type of value for config option '%s'", name);
} else
ret = TRUE;
diff --git a/openbox/cparse.l b/openbox/cparse.l
index 3f362668..fcc72f06 100644
--- a/openbox/cparse.l
+++ b/openbox/cparse.l
@@ -90,10 +90,10 @@ static void newline()
if (!comment) {
if (!haserror && entry.name != NULL && (signed)entry.type >= 0) {
if (!config_set(entry.name, entry.type, entry.value))
- g_warning("Invalid option in '%s': '%s'\n",
- yyfilename, entry.name);
+ g_warning("Parser error in '%s' on line %d\n", yyfilename,
+ yylineno);
} else {
- printf("Parser error in '%s' on line %d\n", yyfilename, yylineno);
+ g_warning("Parser error in '%s' on line %d", yyfilename, yylineno);
}
g_free(entry.name);
entry.name = NULL;