#!/usr/bin/tclsh
-# $Id: robot.tcl,v 1.35 2003/06/10 11:43:52 adam Exp $
+# $Id: robot.tcl,v 1.40 2003/06/10 12:46:04 adam Exp $
#
proc RobotFileNext1 {area lead} {
# puts "RobotFileNext1 area=$area lead=$lead"
for {set i $l} {$i > 0} {incr i -1} {
set path [join [lrange $comp 0 $i] /]
if {![catch {glob $path/*}]} return
- exec rmdir ./$path
+ exec rmdir $path
}
# puts "RobotFileUnlink end"
}
global status
global debuglevel
+ puts "RobotFileOpen task=$task path=$path"
+
if {![info exists workdir]} {
return stdout
}
for {set i 0} {$i <= $len} {incr i} {
set d [lindex $comp $i]
- if {[catch {cd $d}]} {
+ if {[string length $d] == 0} {
+ cd /
+ } elseif {[catch {cd $d}]} {
+ puts "mkdir (1) d=$d"
exec mkdir $d
cd ./$d
if {![string compare $area unvisited] && $i == $len && $mode == "w"} {
set d "d[lindex $comp $i]"
if {[string length $d] > 1} {
if {[catch {cd $d}]} {
+ puts "mkdir (2) d=$d"
exec mkdir $d
cd ./$d
}
set f [open $fname r]
set xml [read $f]
puts "Reading $fname"
- regexp {<status>([^<]*)</status>} $xml x status
close $f
+ if {![regexp {<status>([^<]*)</status>} $xml x status]} {
+ return
+ }
if {$status == "done"} {
puts "already done"
return
return 0
}
}
+ if {$debuglevel > 3} {
+ puts "CHECKFULE MATCH FAIL"
+ }
+ return 0
}
if {$debuglevel > 3} {
puts "CHECKRULE MATCH OK"
if {$l < 2} {
puts {tclrobot: usage:}
- puts {tclrobot [-j jobs] [-i idle] [-c count] [-d domain] [-r rules] [url ..]}
+ puts {tclrobot [-j jobs] [-i idle] [-c count] [-d domain] [-D dir] [-r rules] [url ..]}
puts " Example: -c 3 -d '*.dk' http://www.indexdata.dk/"
exit 1