X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=robot.tcl;h=2d9ea64253d2dcf8b24e82ff07888f570d48f1cf;hb=e0e42a2b8319ccf7b548ba425d42ba4c82b97ce0;hp=968e64e14bd24eac406e5a345aad3fc20182dbb0;hpb=5a6e4380b9b39674fb63839a5aeaa23cb68537cb;p=tclrobot.git diff --git a/robot.tcl b/robot.tcl index 968e64e..2d9ea64 100755 --- a/robot.tcl +++ b/robot.tcl @@ -1,5 +1,5 @@ #!/usr/bin/tclsh -# $Id: robot.tcl,v 1.36 2003/06/10 11:55:18 adam Exp $ +# $Id: robot.tcl,v 1.41 2003/06/10 13:16:16 adam Exp $ # proc RobotFileNext1 {area lead} { # puts "RobotFileNext1 area=$area lead=$lead" @@ -131,7 +131,7 @@ proc RobotFileUnlink {task area host path} { 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" } @@ -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 @@ -1058,6 +1066,8 @@ proc checkrule {task type this} { global control global debuglevel + set default_ret 1 + if {$debuglevel > 3} { puts "CHECKRULE $type $this" } @@ -1071,6 +1081,7 @@ proc checkrule {task type this} { # consider mask (! negates) set masks [lindex $l 2] set ok 0 + set default_ret 0 foreach mask $masks { if {$debuglevel > 4} { puts "consider single mask $mask" @@ -1102,9 +1113,9 @@ proc checkrule {task type this} { } } if {$debuglevel > 3} { - puts "CHECKRULE MATCH OK" + puts "CHECKRULE MATCH DEFAULT $default_ret" } - return 1 + return $default_ret }