chiark / gitweb /
switch a few left-over from GPLv2 to GPLv2 or later
[elogind.git] / extras / rule_generator / rule_generator.functions
index 495bb7b04743caad1fe402521ecfc16e2b33e1bf..e2060a2ece02c8b13b22f6f4d0c5a7bb08494a36 100644 (file)
@@ -1,8 +1,22 @@
 # functions used by the udev rule generator
+
+# Copyright (C) 2006 Marco d'Itri <md@Linux.IT>
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+PATH='/sbin:/bin'
 #
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation version 2 of the License.
 
 PATH='/sbin:/bin'
 
@@ -92,6 +106,9 @@ find_all_rules() {
        local linkre="$2"
        local match="$3"
 
-       local search='.*[[:space:],]'"$key"'"\('"$linkre"'\)"[[:space:]]*\(,.*\|\\\|\)$'
-       echo $(sed -n -e "${match}s/${search}/\1/p" $RO_RULES_FILE $RULES_FILE 2>/dev/null)
+       local search='.*[[:space:],]'"$key"'"('"$linkre"')".*'
+       echo $(sed -n -r -e 's/^#.*//' -e "${match}s/${search}/\1/p" \
+               $RO_RULES_FILE \
+               $([ -e $RULES_FILE ] && echo $RULES_FILE) \
+               2>/dev/null)
 }