lib/update.updates
branchdns-new
changeset 610 cb4607af8663
parent 608 4ad9c9b7cd0e
child 624 889ecd6dcb4e
--- a/lib/update.updates	Thu Dec 19 00:55:22 2013 +0200
+++ b/lib/update.updates	Thu Dec 19 01:17:48 2013 +0200
@@ -123,13 +123,26 @@
 function zone_includes {
     local cache="$1"
     local src="$2"
-    local dir="$3"
+    local prefix="${3:-}"
 
     if [ ! -e "$cache" -o "$cache" -ot "$src" ]; then
         read_zone_includes "$src" > "$cache"
     fi
 
     while read include; do
-        echo -n "$dir/$include "
+        echo -n "$prefix$include "
     done < "$cache"
 }
+
+## Search for prefix-matching includes in zone file
+function zone_includes_grep {
+    local cache="$1"
+    local src="$2"
+    local prefix="$3"
+    
+    for include in $(zone_includes $cache $src); do
+        if [ "${include#$prefix}" != "$include" ]; then
+            echo -n " ${include#$prefix}"
+        fi
+    done
+}