From: Adam Dickmeiss Date: Tue, 30 Oct 2001 08:29:54 +0000 (+0000) Subject: Pattern may be negated in rules (! as first character does that) X-Git-Tag: ZMBOT.0.1~16 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=347b3d01c32f71e2dc2a85fe05b53adbc5e33871;p=tclrobot.git Pattern may be negated in rules (! as first character does that) --- diff --git a/robot.tcl b/robot.tcl index 7c3dbe6..4a30d17 100755 --- 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 --- 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