From: Adam Dickmeiss Date: Fri, 9 Nov 2001 13:26:50 +0000 (+0000) Subject: Robot follows . X-Git-Tag: ZMBOT.0.1~9 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=ea1f20b132694037f8a3a8c3ed03e972d64f1a68;p=tclrobot.git Robot follows . --- diff --git a/robot.tcl b/robot.tcl index f6d7900..f94c8d3 100755 --- a/robot.tcl +++ b/robot.tcl @@ -1,5 +1,5 @@ #!/usr/bin/tclsh -# $Id: robot.tcl,v 1.26 2001/11/08 13:49:06 adam Exp $ +# $Id: robot.tcl,v 1.27 2001/11/09 13:26:50 adam Exp $ # proc RobotFileNext1 {area lead} { # puts "RobotFileNext1 area=$area lead=$lead" @@ -549,6 +549,56 @@ proc RobotTextHtml {url out} { } } } + } -nonest frame { + if {![info exists parm(src)]} { + puts "no src" + continue + } + if {[expr $distance <= $maxdistance]} { + set href [string trim $parm(src)] + if {![RobotHref $url href host path]} continue + + puts $out "" + puts $out "$href" + puts $out "" + puts $out "" + + if {![RobotFileExist visited $host $path]} { + set olddistance 1000 + if {![RobotFileExist bad $host $path]} { + if {[RobotFileExist unvisited $host $path]} { + set inf [RobotFileOpen unvisited $host $path r] + RobotReadRecord $inf oldurl olddistance + RobotFileClose $inf + } + } else { + set olddistance 0 + } + if {[string length $olddistance] == 0} { + set olddistance 1000 + } + if {[expr $distance < $olddistance]} { + set outf [RobotFileOpen unvisited $host $path] + RobotWriteRecord $outf $url $distance + RobotFileClose $outf + } + } elseif {[string compare $href $url]} { + set inf [RobotFileOpen visited $host $path r] + RobotReadRecord $inf xurl olddistance + close $inf + if {[string length $olddistance] == 0} { + set olddistance 1000 + } + if {[expr $distance < $olddistance]} { + puts "OK remarking url=$url href=$href" + puts "olddistance = $olddistance" + puts "newdistance = $distance" + set outf [RobotFileOpen unvisited $host $path] + RobotWriteRecord $outf $url $distance + RobotFileClose $outf + } + } + } } }