+proc RobotFileWait {} {
+ global robotSeq
+ set robotSeq 0
+}
+
+proc RobotFileNext {area} {
+ global robotSeq
+ if {[catch {set ns [glob ${area}/*]}]} {
+ return {}
+ }
+ set off [string length $area]
+ incr off
+
+ set n [lindex $ns $robotSeq]
+ if {![string length $n]} {
+ puts "------------ N E X T R O U N D --------"
+ set robotSeq -1
+ after 2000 RobotFileWait
+ vwait robotSeq
+
+ set n [lindex $ns $robotSeq]
+ if {![string length $n]} {
+ return {}
+ }
+ }
+ incr robotSeq
+ if {[file isfile $n/robots.txt]} {
+ puts "ok returning http://[string range $n $off end]/robots.txt"
+ return http://[string range $n $off end]/robots.txt
+ } elseif {[file isdirectory $n]} {
+ set sb [RobotFileNext1 $n]
+ if {[string length $sb]} {
+ return $sb
+ }
+ }
+ return {}
+}
+
+