#!/usr/bin/tclsh
-# $Id: robot.tcl,v 1.43 2003/06/11 09:40:22 adam Exp $
+# $Id: robot.tcl,v 1.44 2003/06/11 10:11:39 adam Exp $
#
proc RobotFileNext1 {area lead} {
# puts "RobotFileNext1 area=$area lead=$lead"
}
proc RobotWriteRecord {outf fromurl distance} {
+ puts $outf {<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>}
puts $outf "<zmbot>"
puts $outf "<distance>"
puts $outf $distance
upvar $distancex distance
gets $inf
gets $inf
+ gets $inf
set distance [string trim [gets $inf]]
# puts "got distance = $distance"
gets $inf
proc RobotWriteMetadata {task url out} {
global URL
+ set charset $URL($task,$url,charset)
+ puts $out "<?xml version=\"1.0\" encoding=\"$charset\" standalone=\"yes\"?>"
puts $out "<zmbot>"
set distance 1000
set version {}
set headbuf [string range $URL($task,$url,buf) 0 $n]
incr n 4
+ set URL($task,$url,charset) ISO-8859-1
set URL($task,$url,buf) [string range $URL($task,$url,buf) $n end]
regexp {^HTTP/([0-9.]+)[ ]+([0-9]+)} $headbuf x version code
if {[regexp {^([^:]+):[ ]+([^;]*)} $line x name value]} {
set URL($task,$url,head,[string tolower $name]) [string trim $value]
}
+ regexp {^Content-Type:.*charset=([A-Za-z0-9_-]*)} $line x URL($task,$url,charset)
}
puts "HTTP CODE $code"
set URL($task,$url,state) skip