X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=robot.tcl;h=35b1091f9bc12c2e8db2ab61565579cc2dbde557;hb=e0020fef38d72084393c3d91a12c3a240cbfd4a9;hp=55e7f2a2b0d066f92df90daa8156db2277420c39;hpb=5c476d6b3055153cfcb6972965b6e450f685ddeb;p=tclrobot.git
diff --git a/robot.tcl b/robot.tcl
index 55e7f2a..35b1091 100755
--- a/robot.tcl
+++ b/robot.tcl
@@ -1,5 +1,5 @@
#!/usr/bin/tclsh
-# $Id: robot.tcl,v 1.35 2003/06/10 11:43:52 adam Exp $
+# $Id: robot.tcl,v 1.39 2003/06/10 12:29:48 adam Exp $
#
proc RobotFileNext1 {area lead} {
# puts "RobotFileNext1 area=$area lead=$lead"
@@ -148,6 +148,8 @@ proc RobotFileOpen {task area host path {mode w}} {
global status
global debuglevel
+ puts "RobotFileOpen task=$task path=$path"
+
if {![info exists workdir]} {
return stdout
}
@@ -169,7 +171,10 @@ proc RobotFileOpen {task area host path {mode w}} {
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"} {
@@ -193,6 +198,7 @@ proc RobotFileOpen {task area host path {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
}
@@ -219,8 +225,10 @@ proc RobotStartJob {fname t} {
set f [open $fname r]
set xml [read $f]
puts "Reading $fname"
- regexp {([^<]*)} $xml x status
close $f
+ if {![regexp {([^<]*)} $xml x status]} {
+ return
+ }
if {$status == "done"} {
puts "already done"
return
@@ -1100,6 +1108,10 @@ proc checkrule {task type this} {
return 0
}
}
+ if {$debuglevel > 3} {
+ puts "CHECKFULE MATCH FAIL"
+ }
+ return 0
}
if {$debuglevel > 3} {
puts "CHECKRULE MATCH OK"
@@ -1176,7 +1188,7 @@ set l [llength $argv]
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