Pattern may be negated in rules (! as first character does that)
[tclrobot.git] / robot.tcl
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} {