Pattern may be negated in rules (! as first character does that)
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 30 Oct 2001 08:29:54 +0000 (08:29 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 30 Oct 2001 08:29:54 +0000 (08:29 +0000)
robot.tcl
rules

index 7c3dbe6..4a30d17 100755 (executable)
--- a/robot.tcl
+++ b/robot.tcl
@@ -1,5 +1,5 @@
 #!/usr/bin/tclsh 
-# $Id: robot.tcl,v 1.21 2001/10/26 13:26:11 adam Exp $
+# $Id: robot.tcl,v 1.22 2001/10/30 08:29:54 adam Exp $
 #
 proc RobotFileNext1 {area lead} {
     # puts "RobotFileNext1 area=$area lead=$lead"
@@ -861,8 +861,14 @@ proc checkrule {type this} {
             }
             # consider type
             if {[lindex $l 1] != $type} continue
-            # consider mask
-            if {![string match [lindex $l 2] $this]} continue
+            # consider mask (! negates)
+            set mask [lindex $l 2]
+            if {[string index $mask 0] == "!"} {
+                set mask [string range $mask 1 end]
+                if {[string match $mask $this]} continue
+            } else {
+                if {![string match $mask $this]} continue
+            }
             # OK, we have a match
             if {[lindex $l 0] == "allow"} {
                 if {$debuglevel > 3} {
diff --git a/rules b/rules
index a2d0ce7..2abca55 100644 (file)
--- a/rules
+++ b/rules
@@ -1,11 +1,13 @@
-# sample rules $Id: rules,v 1.1 2001/10/26 13:26:11 adam Exp $
+# sample rules $Id: rules,v 1.2 2001/10/30 08:29:54 adam Exp $
 
 url http://www.indexdata.dk
 
 allow url http://www.indexdata.dk/software*
+allow url http://www.indexdata.dk/zap*
 allow url http://www.indexdata.dk/yaz*
 allow url http://www.indexdata.dk/
-deny url *
+deny url http://www.indexdata.dk/*
+deny url !http://*.indexdata.dk/*
 
 allow mime text/html
 allow mime application/pdf