[PATCH 4/4] hal-info: Clean up keymap-check.sh
Victor Lowther
victor.lowther at gmail.com
Mon Mar 24 20:08:32 PDT 2008
Robustify sed XML parsing.
Took cues from the original sed comment-removing script on how to do so.
Getting significant speed improvements is a bonus.
---
tools/keymap-check.sh | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/tools/keymap-check.sh b/tools/keymap-check.sh
index 6d6f1c9..ff2521e 100755
--- a/tools/keymap-check.sh
+++ b/tools/keymap-check.sh
@@ -7,9 +7,14 @@
get_line ()
{
local data
- sed -ne '/^[[:blank:]]*<append key="input.keymap.data"/ { # data lines
- s,<[^>]*>,,g; # get rid of all xml tags
- s,[^:]*:,,; # get rid of leading cruft
+ sed -ne '/<!--/ { # start of comment nuking code
+ :c; /-->/! {N; b c;}; # join all commented lines
+ /-->/ s/<!--.*-->//g }; # bye bye comment
+ /<append key="input.keymap.data"/ { # interesting lines
+ :c; \,</append>,! {N; b c;};
+ \,</append>, {
+ s,<[^>]*>,,g; # get rid of all xml tags
+ s,[^:]*:,,; }; # get rid of leading cruft
p };' "$1" | while read data;
do
grep -q "^${data}\$" /tmp/quirk-keymap-list.txt || echo "$data "
--
1.5.4.3
More information about the hal
mailing list