Commit 076d458e authored by Ulrich Sibiller's avatar Ulrich Sibiller

Keystroke.h: improve parse_keystroke_file()

Print out more/better messages.
parent 79520f9c
...@@ -217,6 +217,8 @@ static Bool read_binding_from_xmlnode(xmlNode *node, struct nxagentSpecialKeystr ...@@ -217,6 +217,8 @@ static Bool read_binding_from_xmlnode(xmlNode *node, struct nxagentSpecialKeystr
break; break;
} }
} }
if (newkm.stroke == KEYSTROKE_NOTHING)
fprintf(stderr, "Info: ignoring unknown keystroke action '%s'.\n", (char *)attr->children->content);
continue; continue;
} }
else if (strcmp((char *)attr->name, "key") == 0) else if (strcmp((char *)attr->name, "key") == 0)
...@@ -281,7 +283,7 @@ static void parse_keystroke_file(Bool force) ...@@ -281,7 +283,7 @@ static void parse_keystroke_file(Bool force)
free(map); free(map);
map = default_map; map = default_map;
} }
fprintf(stderr, "re-reading keystroke config\n"); fprintf(stderr, "Info: re-reading keystrokes configuration\n");
} }
else else
{ {
...@@ -309,7 +311,10 @@ static void parse_keystroke_file(Bool force) ...@@ -309,7 +311,10 @@ static void parse_keystroke_file(Bool force)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
else if ((filename = getenv(envvar)) && access(filename, R_OK) == 0) else if (nxagentKeystrokeFile)
{
fprintf(stderr, "Warning: Cannot read keystroke file '%s'.\n", nxagentKeystrokeFile);
if ((filename = getenv(envvar)) && access(filename, R_OK) == 0)
{ {
if (!(filename = strdup(filename))) if (!(filename = strdup(filename)))
{ {
...@@ -351,15 +356,16 @@ static void parse_keystroke_file(Bool force) ...@@ -351,15 +356,16 @@ static void parse_keystroke_file(Bool force)
filename = NULL; filename = NULL;
} }
} }
}
/* now we know which file to read, if any */ /* now we know which file to read, if any */
if (filename) if (filename)
{ {
fprintf(stderr, "Info: using keystrokes file %s\n", filename);
LIBXML_TEST_VERSION LIBXML_TEST_VERSION
xmlDoc *doc = xmlReadFile(filename, NULL, 0); xmlDoc *doc = xmlReadFile(filename, NULL, 0);
if (doc) if (doc)
{ {
fprintf(stderr, "Info: using keystrokes file '%s'\n", filename);
for (xmlNode *cur = xmlDocGetRootElement(doc); cur; cur = cur->next) for (xmlNode *cur = xmlDocGetRootElement(doc); cur; cur = cur->next)
{ {
if (cur->type == XML_ELEMENT_NODE && strcmp((char *)cur->name, "keystrokes") == 0) if (cur->type == XML_ELEMENT_NODE && strcmp((char *)cur->name, "keystrokes") == 0)
...@@ -427,14 +433,17 @@ static void parse_keystroke_file(Bool force) ...@@ -427,14 +433,17 @@ static void parse_keystroke_file(Bool force)
} }
else else
{ {
#ifdef DEBUG fprintf(stderr, "Warning: could not read/parse keystrokes file '%s'\n", filename);
fprintf(stderr, "XML parsing for %s failed\n", filename);
#endif
} }
free(filename); free(filename);
filename = NULL; filename = NULL;
} }
if (map == default_map)
{
fprintf(stderr, "Info: Using builtin keystrokes.\n");
}
nxagentDumpKeystrokes(); nxagentDumpKeystrokes();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment