Misc. improvements.
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 20 Feb 1996 16:07:39 +0000 (16:07 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 20 Feb 1996 16:07:39 +0000 (16:07 +0000)
www/Makefile
www/egw.res
www/z39util.tcl

index f1b6fa9..e473d74 100644 (file)
@@ -1,7 +1,7 @@
 # Makefile for www gateway utility
 # Europagate, 1995
 #
-# $Id: Makefile,v 1.30 1996/02/19 15:44:59 adam Exp $
+# $Id: Makefile,v 1.31 1996/02/20 16:07:39 adam Exp $
 #
 SHELL=/bin/sh
 #
@@ -15,7 +15,7 @@ LIBIRTCL=../../ir-tcl/libirtcl.a $(ZLIB) $(MOSILIB)
 #
 OLIB=../lib/util.a ../lib/libres+log.a 
 TCLLIB=/usr/local/lib/libtcl7.5.a
-TCLINC=-I../../ir-tcl -I/usr/local/include 
+TCLINC=-I../../ir-tcl 
 #
 WSCRIPTS=egwscript targets.egw query.egw search.egw showfull.egw z39util.tcl \
  mtargets.egw mquery.egw msearch.egw history.egw tform.egw tdefine.egw
index e7e87f7..d34badc 100644 (file)
@@ -1,12 +1,12 @@
 # WWW-Z39.50 Gateway configuration file
 #
-# $Id: egw.res,v 1.3 1996/02/19 15:44:59 adam Exp $
+# $Id: egw.res,v 1.4 1996/02/20 16:07:39 adam Exp $
 
 # FIFO file directory
 fifo.dir: /tmp/egw
 
 # Idle time in seconds before the shell terminates
-timeout: 120
+timeout: 60
 
 # Log level
 log.level: all
index 59131ff..cafca96 100644 (file)
@@ -1,5 +1,5 @@
 #
-# $Id: z39util.tcl,v 1.30 1996/02/12 13:39:41 adam Exp $
+# $Id: z39util.tcl,v 1.31 1996/02/20 16:07:39 adam Exp $
 #
 proc saveState {} {
     uplevel #0 {
@@ -401,7 +401,7 @@ proc display-full {zset no tno} {
         if {"x$sp" == "x"} {
             set sp $url
         }
-        html {<dd><a href="} $url {">} [join $sp] "</a>\n"
+        html {<dd><a href="} [join $url] {">} [join $sp] "</a>\n"
     }
     dl-marc-field $zset $no 037 {[abc]} "Acquisition" {} "<br>\n"
     dl-marc-field $zset $no 037 {[f6]} "Form of issue" {} "<br>\n"
@@ -741,7 +741,7 @@ proc z39search {setNo piggy tno elements} {
     egw_log debug "search: $query"
     $zz.$setNo search $query
 
-    if {[catch {egw_wait sessionWait 600}]} {
+    if {[catch {egw_wait sessionWait 60}]} {
         egw_log debug "timeout/cancel in search"
         displayError "Timeout in search" {}
         html "</body></html>\n"
@@ -767,8 +767,13 @@ proc init-m-response {i} {
 
     egw_log debug "init-m-response"
 
-    set zstatus($i) 1
     incr zleft -1
+    if {![z39$i initResult]} {
+        set zstatus($i) -1
+        z39$i disconnect
+        return
+    }
+    set zstatus($i) 1
 }
 
 proc connect-m-response {i} {
@@ -809,7 +814,7 @@ proc search-m-response {setNo i start number} {
     set nor [z39$i.$setNo numberOfRecordsReturned]
     egw_log debug "search-m-response3"
     set hist($setNo,$i,offset) [expr $start + $nor -1]
-    if {[expr $nor + $start] >= [z39$i.$setNo resultCount]} {
+    if {[expr $nor + $start] > [z39$i.$setNo resultCount]} {
         egw_log debug "search-m-response4"
         incr zleft -1
         set zstatus($i) 2
@@ -817,7 +822,7 @@ proc search-m-response {setNo i start number} {
     }
     egw_log debug "search-m-response5"
     if {$nor >= $number} {
-        egw_log debug "search-m-response6"
+        egw_log debug "search-m-response6 nor=$nor number=$number"
         incr zleft -1
         set zstatus($i) 2
         return
@@ -838,9 +843,11 @@ proc z39msearch {setNo elements start number cache} {
     global zstatus
     global hist
     global targets
+    global debug
 
     set not $hist($setNo,0,host)
 
+    egw_log debug "z39msearch start=$start number=$number elements=$elements"
     for {set i 1} {$i <= $not} {incr i} {
         set host $hist($setNo,$i,host)
         if {[catch [list z39$i failback fail-m-response $i]]} {
@@ -878,14 +885,20 @@ proc z39msearch {setNo elements start number cache} {
     }
     set zleft 0
     for {set i 1} {$i <= $not} {incr i} {
-        html "host " [splitHostSpec $hist($setNo,$i,host)] ": "
+        if {$debug} {
+            html "host " [splitHostSpec $hist($setNo,$i,host)] ": "
+        }
         egw_log debug "i=$i zstatus=$zstatus($i)"
         if {$zstatus($i) < 1} {
-            html "fail<br>\n"
+            if {$debug} {
+                html "fail<br>\n"
+            }
             continue
         }
         if {[catch [list z39$i.$setNo preferredRecordSyntax USMARC]]} {
-            html "ok<br>\n"
+            if {$debug} {
+                html "ok<br>\n"
+            }
             ir-set z39$i.$setNo z39$i
             set hist($setNo,$i,offset) 0
             eval z39$i.$setNo databaseNames $hist($setNo,$i,database)
@@ -933,15 +946,21 @@ proc z39msearch {setNo elements start number cache} {
             z39$i.$setNo recordElements $thisElements
 
             for {set n 0} {$n < $tnumber} {incr n} {
-                if {[z39$i.$setNo type [expr $start + $n]] == ""} {
+                if {[z39$i.$setNo recordType [expr $start + $n]] == ""} {
                     if {$n > 0} {
                         egw_log debug "failed on $n"
                     }
+                    if {$debug} {
+                        html "no record at #" [expr $start + $n]
+                        html " el=-" $thisElements "-"
+                    }
                     break
                 }
             }
             if {$n == $tnumber} {
-                html "cached<br>\n"
+                if {$debug} {
+                    html "cached<br>\n"
+                }
                 continue
             }
             
@@ -952,7 +971,9 @@ proc z39msearch {setNo elements start number cache} {
             egw_log debug "mpresent start=$start number=$tnumber"
             z39$i.$setNo present $start $tnumber
         } else {
-            html "ok<br>\n"
+            if {$debug} {
+                html "ok<br>\n"
+            }
         }
     }
     while {$zleft > 0} {
@@ -995,7 +1016,7 @@ proc z39present {setNo tno setOffset setMax dfunc elements} {
 
     while {$setMax > 0 && $toGet > 0} {
         for {set got 0} {$got < $toGet} {incr got} {
-            if {[$zz.$setNo type [expr $setOffset + $got]] == ""} {
+            if {[$zz.$setNo recordType [expr $setOffset + $got]] == ""} {
                 break
             }
         }