privoxy-regression-test: Bump copyright
[privoxy.git] / tools / url-pattern-translator.pl
index 9dfa78f..5477a87 100755 (executable)
 #
 # url-pattern-translator.pl old.action > new.action 
 #
-# Only convert your files once, or, as RoboCop used to say,
-# there will be... trouble.
-#
-# $Id: url-pattern-translator.pl 1.10 2008/08/10 16:32:59 fk Exp $
-#
 # Copyright (c) 2008 Fabian Keil <fk@fabiankeil.de>
 #
 # Permission to use, copy, modify, and distribute this software for any
@@ -63,7 +58,7 @@ sub convert_host_pattern ($) {
     }
 
     # Match-all syntax has changed ...
-    $hp =~ s@\*@.*@g;
+    $hp =~ s@\*@[^.]*@g;
 
     # Extended host patterns are right-anchored by default
     $hp =~ s@\.$@(\..*)?@;
@@ -74,6 +69,9 @@ sub convert_host_pattern ($) {
     # Match single character with a dot.
     $hp =~ s@(?<!\))\?@.@g;
 
+    # Add the prefix
+    $hp = "PCRE-HOST-PATTERN:" . $hp;
+
     return $hp;
 }
 
@@ -93,7 +91,11 @@ sub looks_interesting($) {
 
         $type_to_skip = "whitespace";
 
-    } elsif (m@^\s*TAG:@) {
+    } elsif (m@^\s*CLIENT-TAG:@i) {
+
+        $type_to_skip = "client tag patttern";
+
+    } elsif (m@^\s*TAG:@i) {
 
         $type_to_skip = "tag patttern";
 
@@ -101,9 +103,17 @@ sub looks_interesting($) {
 
         $type_to_skip = "macro or version definition";
 
+    } elsif (m@^\s*standard\.@) {
+
+        $type_to_skip = "predefined settings";
+
+    } elsif (m@^\s*PCRE-HOST-PATTERN:@i) {
+
+        $type_to_skip = "already converted pcre host patttern";
+
     }
 
-    #p("Skipping " . $type_to_skip . ": " . $_);
+    #p("Skipping " . $type_to_skip . ": " . $_) if defined $type_to_skip;
 
     return not defined $type_to_skip;
 }