From ea1f20b132694037f8a3a8c3ed03e972d64f1a68 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 9 Nov 2001 13:26:50 +0000 Subject: [PATCH] Robot follows . --- robot.tcl | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) 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 + } + } + } } } -- 1.7.10.4