chiark / gitweb /
rules: fix md "change"/"remove" handling
[elogind.git] / extras / rule_generator / rule_generator.functions
index 14c585a86ae442f2dcfca5785b27471790b6ac79..b972091615d424c56149dc6944055b64c44665b4 100644 (file)
@@ -92,7 +92,9 @@ find_all_rules() {
        local linkre="$2"
        local match="$3"
 
-       [ -e $RULES_FILE ] || return
-       local search='.*[[:space:],]'"$key"'"\('"$linkre"'\)"[[:space:]]*\(,.*\|\\\|\)$'
-       echo $(sed -n -e "${match}s/${search}/\1/p" $RO_RULES_FILE $RULES_FILE)
+       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)
 }