X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=dcdot.tcl;h=a29e6f5414c136b99ce6073d8aed5b641179d9db;hb=563c2ed58045d7cd4c977af162f13d1fa308b4a5;hp=aeb4f91484a9e635a060ee5d3ff9f6e66bc8c51a;hpb=d8234df96ab8fb03ed71f6358f7211ebe725b495;p=tclrobot.git diff --git a/dcdot.tcl b/dcdot.tcl index aeb4f91..a29e6f5 100755 --- a/dcdot.tcl +++ b/dcdot.tcl @@ -1,5 +1,5 @@ #!/usr/bin/tclsh -# $Id: dcdot.tcl,v 1.1 2000/12/07 20:16:11 adam Exp $ +# $Id: dcdot.tcl,v 1.3 2000/12/08 22:46:53 adam Exp $ # proc RobotRestart {} { @@ -11,28 +11,14 @@ proc RobotRestart {} { proc RobotTextHtml {url} { global URL - set head 0 - htmlSwitch $URL($url,buf) \ - title { - set URL($url,title) $body - } -nonest meta { - set scheme {} - if {[info exist parm(scheme)]} { - set scheme $parm(scheme) - unset parm(scheme) - } - if {[info exist parm(name)]} { - if {[info exist parm(content)]} { - set URL($url,meta,$parm(name),$scheme) $parm(content) - unset parm(content) - } - unset parm(name) - } - } a { - if {[info exists parm(href)]} { - lappend URL($url,links) $parm(href) - } - } + set b $URL($url,buf) + set e {<[mM][eE][tT][aA][^>]*>} + catch {unset $URL($url,meta)} + while {[regexp -indices $e $b i]} { + set meta [string range $b [lindex $i 0] [lindex $i 1]] + lappend URL($url,meta) $meta + set b [string range $b [lindex $i 1] end] + } } proc Robot200 {url} { @@ -113,7 +99,6 @@ proc RobotReadHeader {url sock} { } } default { - Robot404 $url close $sock RobotRestart } @@ -157,14 +142,7 @@ proc RobotGetUrl {url phost} { return 0 } -if {![llength [info commands htmlSwitch]]} { - set e [info sharedlibextension] - if {[catch {load ./tclrobot$e}]} { - load tclrobot$e - } -} - -set agent "zmbot/0.0" +set agent "dcdot.tcl/0.0" if {![catch {set os [exec uname -s -r]}]} { set agent "$agent ($os)" } @@ -185,8 +163,13 @@ proc RobotGetDCDOT {url} { if {$argc == 1} { set url [lindex $argv 0] RobotGetDCDOT $url - set mask {,meta,[Dd][Cc]\.*} - foreach a [array names URL $url$mask] { - puts "URL($a) = $URL($a)" + set mask {,meta} + if {[info exist URL($url,meta)]} { + foreach m $URL($url,meta) { + puts $m + } } -} \ No newline at end of file + foreach v [array names URL $url,head,*] { + puts "$v = $URL($v)" + } +}