X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=www%2Fz39util.tcl;h=6b56df4e5158d468fbdf49234378793a13bbb15a;hb=3d4b6045b8875099666b99edbf1457c91b5da928;hp=20fcec2a99befb5a2a9015fc8bb65c14f4372ac4;hpb=6315a552d51ac08b60d25d8500da5574a83ba530;p=egate.git diff --git a/www/z39util.tcl b/www/z39util.tcl index 20fcec2..6b56df4 100644 --- a/www/z39util.tcl +++ b/www/z39util.tcl @@ -1,5 +1,5 @@ # -# $Id: z39util.tcl,v 1.3 1995/11/08 12:42:18 adam Exp $ +# $Id: z39util.tcl,v 1.5 1995/11/08 18:07:23 adam Exp $ # proc saveState {} { uplevel #0 { @@ -8,15 +8,18 @@ proc saveState {} { if {$var == "f"} continue if {$var == "sessionId"} continue if {$var == "errorInfo"} continue - set names [array names $var] - if {$names != ""} { + if {[catch {set names [array names $var]}]} { + eval "set v \$${var}" + puts $f "set ${var} \{$v\}" + } else { foreach n $names { eval "set v \$${var}(\$n)" puts $f "set ${var}($n) \{$v\}" } - } else { - eval "set v \$${var}" - puts $f "set ${var} \{$v\}" + catch { + eval "set v \$${var}" + puts $f "set ${var} \{$v\}" + } } } close $f @@ -78,7 +81,7 @@ proc display-brief {zset no} { set title [lindex [$zset getMarc $no field 245 * a] 0] set year [lindex [$zset getMarc $no field 260 * c] 0] } ] } { - html { } $title {} html " ${year} " } @@ -211,9 +214,14 @@ proc z39search {setNo piggy} { html "Cannot initialize with target ${host}
\n" return 0 } - zwait sessionWait + if {[catch {zwait sessionWait 60}]} { + html "Cannot initialize with target ${host}
\n" + z39 disconnect + return 0 + } if {$sessionWait != "1"} { html "Cannot initialize with target ${host}
\n" + z39 disconnect return 0 } } @@ -238,9 +246,15 @@ proc z39search {setNo piggy} { set sessionWait 0 z39.$setNo search $hist($setNo,query) - zwait sessionWait + if {[catch {zwait sessionWait 600}]} { + html "\n" + z39 disconnect + return 0 + } + if {$sessionWait != 1} { html "\n" + z39 disconnect return 0 } set status [z39.$setNo responseStatus] @@ -392,7 +406,10 @@ proc z39present {setNo setOffset setMax dfunc} { if {$got < $toGet} { set sessionWait 0 z39.$setNo present $setOffset $toGet - zwait sessionWait + if {[catch {zwait sessionWait 300}]} { + z39 disconnect + break + } if {$sessionWait != "1"} { break } @@ -417,7 +434,7 @@ proc z39history {} { } html "

History

\n" for {set setNo 1} {$setNo < $nextSetNo} {incr setNo} { - html {
} [lindex $targets($hist($setNo,host)) 0] @@ -437,4 +454,4 @@ proc z39history {} { html "\n" } html "
\n" -} \ No newline at end of file +}