summaryrefslogtreecommitdiff
path: root/extras/rule_generator
diff options
context:
space:
mode:
authorMarco d'Itri <md@Linux.IT>2008-07-07 14:32:33 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-07-07 14:32:33 +0200
commit03effd3bc9967da27db865ccb6480a805701b09f (patch)
tree3248701dc72eb8cb0f3f0a734e605b0f3f75f3c5 /extras/rule_generator
parent9d2a06d7c6a1a818e42dd95f79b01f7e91a59098 (diff)
rules_generator: net rules - do not print error if file is missing and ignore commented rules
Fix an error message displayed by write_net_rules when the rules file does not exist yet. (See Debian bugs #442796 and #475699.) Ignore commented rules, at least for the easy case. For clarity, use extended instead of standard regular expressions.
Diffstat (limited to 'extras/rule_generator')
-rw-r--r--extras/rule_generator/rule_generator.functions8
1 files changed, 6 insertions, 2 deletions
diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions
index 495bb7b047..aaf66a6fa0 100644
--- a/extras/rule_generator/rule_generator.functions
+++ b/extras/rule_generator/rule_generator.functions
@@ -92,6 +92,10 @@ 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"')"[[:space:]]*(,.*|\\|)$'
+
+ echo $(sed -n -r -e 's/^#.*//' -e "${match}s/${search}/\1/p" \
+ $RO_RULES_FILE \
+ $([ -e $RULES_FILE ] && echo $RULES_FILE) \
+ 2>/dev/null)
}