[PATCH 3/4] hal-info: Clean up keymap-check.sh
Victor Lowther
victor.lowther at gmail.com
Mon Mar 24 20:08:21 PDT 2008
Fix glitch in the sed expression in get_line. I was not ignoring commented
lines. I am now.
Also get rid of isin -- it was misleadingly named, and it is now a one-liner.
[ "$z" ] == [ ! -z "$z" ] Use the simpler one.
---
tools/keymap-check.sh | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/tools/keymap-check.sh b/tools/keymap-check.sh
index 881f7bc..6d6f1c9 100755
--- a/tools/keymap-check.sh
+++ b/tools/keymap-check.sh
@@ -2,26 +2,21 @@
# Copyright Richard Hughes <richard at hughsie.com>
# checks to see if the keycode is in the quirk keymap list
-isin ()
-{
- grep -q "^${1}\$" /tmp/quirk-keymap-list.txt && return 1
- return 0
-}
# processes each line of the fdi file
get_line ()
{
local data
- sed -ne '/<append key="input.keymap.data"/ { # only keymap data lines
+ sed -ne '/^[[:blank:]]*<append key="input.keymap.data"/ { # data lines
s,<[^>]*>,,g; # get rid of all xml tags
s,[^:]*:,,; # get rid of leading cruft
p };' "$1" | while read data;
do
- isin $data && echo "$data "
+ grep -q "^${data}\$" /tmp/quirk-keymap-list.txt || echo "$data "
done
}
-# processes each line of the fdi file
+# processes each of the fdi files
get_files ()
{
local retval=0
@@ -29,12 +24,12 @@ get_files ()
do
status="ok"
ret=`get_line "${file}"`
- if [ ! -z "$ret" ]; then
+ if [ "$ret" ]; then
status="FAILED"
retval=1
fi
echo "Validate keycode in ${file} : ${status}"
- if [ ! -z "$ret" ]; then
+ if [ "$ret" ]; then
echo "$ret"
fi
done
--
1.5.4.3
More information about the hal
mailing list