Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
076d458e
Commit
076d458e
authored
Mar 23, 2017
by
Ulrich Sibiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keystroke.h: improve parse_keystroke_file()
Print out more/better messages.
parent
79520f9c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
35 deletions
+44
-35
Keystroke.c
nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
+44
-35
No files found.
nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
View file @
076d458e
...
...
@@ -217,6 +217,8 @@ static Bool read_binding_from_xmlnode(xmlNode *node, struct nxagentSpecialKeystr
break
;
}
}
if
(
newkm
.
stroke
==
KEYSTROKE_NOTHING
)
fprintf
(
stderr
,
"Info: ignoring unknown keystroke action '%s'.
\n
"
,
(
char
*
)
attr
->
children
->
content
);
continue
;
}
else
if
(
strcmp
((
char
*
)
attr
->
name
,
"key"
)
==
0
)
...
...
@@ -281,7 +283,7 @@ static void parse_keystroke_file(Bool force)
free
(
map
);
map
=
default_map
;
}
fprintf
(
stderr
,
"
re-reading keystroke config
\n
"
);
fprintf
(
stderr
,
"
Info: re-reading keystrokes configuration
\n
"
);
}
else
{
...
...
@@ -309,37 +311,12 @@ static void parse_keystroke_file(Bool force)
exit
(
EXIT_FAILURE
);
}
}
else
if
(
(
filename
=
getenv
(
envvar
))
&&
access
(
filename
,
R_OK
)
==
0
)
else
if
(
nxagentKeystrokeFile
)
{
if
(
!
(
filename
=
strdup
(
filename
)))
fprintf
(
stderr
,
"Warning: Cannot read keystroke file '%s'.
\n
"
,
nxagentKeystrokeFile
);
if
((
filename
=
getenv
(
envvar
))
&&
access
(
filename
,
R_OK
)
==
0
)
{
fprintf
(
stderr
,
"malloc failed"
);
exit
(
EXIT_FAILURE
);
}
}
else
{
char
*
homedir
=
getenv
(
"HOME"
);
filename
=
NULL
;
if
(
homedir
)
{
if
(
!
(
filename
=
calloc
(
1
,
strlen
(
homefile
)
+
strlen
(
homedir
)
+
1
)))
{
fprintf
(
stderr
,
"malloc failed"
);
exit
(
EXIT_FAILURE
);
}
strcpy
(
filename
,
homedir
);
strcpy
(
filename
+
strlen
(
homedir
),
homefile
);
}
if
(
access
(
filename
,
R_OK
)
==
0
)
{
/* empty */
}
else
if
(
access
(
etcfile
,
R_OK
)
==
0
)
{
free
(
filename
);
if
(
!
(
filename
=
strdup
(
etcfile
)))
if
(
!
(
filename
=
strdup
(
filename
)))
{
fprintf
(
stderr
,
"malloc failed"
);
exit
(
EXIT_FAILURE
);
...
...
@@ -347,19 +324,48 @@ static void parse_keystroke_file(Bool force)
}
else
{
free
(
filename
);
char
*
homedir
=
getenv
(
"HOME"
);
filename
=
NULL
;
if
(
homedir
)
{
if
(
!
(
filename
=
calloc
(
1
,
strlen
(
homefile
)
+
strlen
(
homedir
)
+
1
)))
{
fprintf
(
stderr
,
"malloc failed"
);
exit
(
EXIT_FAILURE
);
}
strcpy
(
filename
,
homedir
);
strcpy
(
filename
+
strlen
(
homedir
),
homefile
);
}
if
(
access
(
filename
,
R_OK
)
==
0
)
{
/* empty */
}
else
if
(
access
(
etcfile
,
R_OK
)
==
0
)
{
free
(
filename
);
if
(
!
(
filename
=
strdup
(
etcfile
)))
{
fprintf
(
stderr
,
"malloc failed"
);
exit
(
EXIT_FAILURE
);
}
}
else
{
free
(
filename
);
filename
=
NULL
;
}
}
}
/* now we know which file to read, if any */
if
(
filename
)
{
fprintf
(
stderr
,
"Info: using keystrokes file %s
\n
"
,
filename
);
LIBXML_TEST_VERSION
xmlDoc
*
doc
=
xmlReadFile
(
filename
,
NULL
,
0
);
if
(
doc
)
{
fprintf
(
stderr
,
"Info: using keystrokes file '%s'
\n
"
,
filename
);
for
(
xmlNode
*
cur
=
xmlDocGetRootElement
(
doc
);
cur
;
cur
=
cur
->
next
)
{
if
(
cur
->
type
==
XML_ELEMENT_NODE
&&
strcmp
((
char
*
)
cur
->
name
,
"keystrokes"
)
==
0
)
...
...
@@ -427,14 +433,17 @@ static void parse_keystroke_file(Bool force)
}
else
{
#ifdef DEBUG
fprintf
(
stderr
,
"XML parsing for %s failed
\n
"
,
filename
);
#endif
fprintf
(
stderr
,
"Warning: could not read/parse keystrokes file '%s'
\n
"
,
filename
);
}
free
(
filename
);
filename
=
NULL
;
}
if
(
map
==
default_map
)
{
fprintf
(
stderr
,
"Info: Using builtin keystrokes.
\n
"
);
}
nxagentDumpKeystrokes
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment