From 0b673e359cca2fdb88719de3d20d5488ead9fefb Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 26 Mar 2001 11:39:34 +0000 Subject: [PATCH] Fixed bug in ir_deleteDiags - crash when receiving multiple diags. --- CHANGELOG | 6 +++- ir-tcl.c | 9 ++++-- irtdb.tcl | 32 ++++++++++++++++++++-- msearch.tcl | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+), 6 deletions(-) create mode 100755 msearch.tcl diff --git a/CHANGELOG b/CHANGELOG index e2eaa08..79604fb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -$Id: CHANGELOG,v 1.44 2001-02-09 11:58:04 adam Exp $ +$Id: CHANGELOG,v 1.45 2001-03-26 11:39:34 adam Exp $ 06/19/95 Release of ir-tcl-1.0b ------------------------------------------------------ @@ -137,3 +137,7 @@ $Id: CHANGELOG,v 1.44 2001-02-09 11:58:04 adam Exp $ 02/09/01 Updated for Tcl8.1 and upwards where internal encoding is UTF-8. Queries and Scan star terms are converted to external encoding. + +03/26/01 Fixed bug in ir_deleteDiags. Thanks to Rustam T. Usmanov + + diff --git a/ir-tcl.c b/ir-tcl.c index c42a61f..c6e789b 100644 --- a/ir-tcl.c +++ b/ir-tcl.c @@ -1,10 +1,13 @@ /* * IR toolkit for tcl/tk - * (c) Index Data 1995-2000 + * (c) Index Data 1995-2001 * See the file LICENSE for details. * * $Log: ir-tcl.c,v $ - * Revision 1.116 2001-02-09 11:58:04 adam + * Revision 1.117 2001-03-26 11:39:34 adam + * Fixed bug in ir_deleteDiags - crash when receiving multiple diags. + * + * Revision 1.116 2001/02/09 11:58:04 adam * Updated for Tcl8.1 and higher where internal encoding is UTF-8. * * Revision 1.115 2000/09/13 12:18:49 adam @@ -3863,7 +3866,7 @@ static void ir_deleteDiags (IrTcl_Diagnostic **dst_list, int *dst_num) { int i; for (i = 0; i<*dst_num; i++) - xfree (dst_list[i]->addinfo); + xfree ((*dst_list)[i].addinfo); xfree (*dst_list); *dst_list = NULL; *dst_num = 0; diff --git a/irtdb.tcl b/irtdb.tcl index 614afe9..3f821e8 100644 --- a/irtdb.tcl +++ b/irtdb.tcl @@ -278,7 +278,7 @@ set {profile(Data Research Associates,smallSetUpperBound)} 0 set {profile(Data Research Associates,targetInfoName)} {} set {profile(Data Research Associates,timeDefine)} 944954622 set {profile(Data Research Associates,timeLastExplain)} {} -set {profile(Data Research Associates,timeLastInit)} 955717347 +set {profile(Data Research Associates,timeLastInit)} 983197460 set {profile(Data Research Associates,welcomeMessage)} {} set {profile(Data Research Associates,windowNumber)} 5 set profile(Default,authentication) {} @@ -306,7 +306,7 @@ set profile(Default,timeDefine) {} set profile(Default,timeLastExplain) {} set profile(Default,timeLastInit) {} set profile(Default,welcomeMessage) {} -set profile(Default,windowNumber) 20 +set profile(Default,windowNumber) 21 set {profile(Emory Library Catalog,authentication)} {} set {profile(Emory Library Catalog,comstack)} tcpip set {profile(Emory Library Catalog,databases)} unicorn @@ -335,6 +335,34 @@ set {profile(Emory Library Catalog,timeLastExplain)} {} set {profile(Emory Library Catalog,timeLastInit)} 971250665 set {profile(Emory Library Catalog,welcomeMessage)} {} set {profile(Emory Library Catalog,windowNumber)} 9 +set profile(LOC,authentication) {} +set profile(LOC,comstack) tcpip +set profile(LOC,databases) voyager +set profile(LOC,description) {} +set profile(LOC,host) z3950.loc.gov +set profile(LOC,idAuthentication) {} +set profile(LOC,largeSetLowerBound) 2 +set profile(LOC,maxResultSets) {} +set profile(LOC,maxResultSize) {} +set profile(LOC,maxTerms) {} +set profile(LOC,maximumRecordSize) 50000 +set profile(LOC,mediumSetPresentNumber) 0 +set profile(LOC,multipleDatabases) 0 +set profile(LOC,namedResultSets) 1 +set profile(LOC,port) 7090 +set profile(LOC,preferredMessageSize) 30000 +set profile(LOC,presentChunk) 4 +set profile(LOC,protocol) Z39 +set profile(LOC,queryCCL) 0 +set profile(LOC,queryRPN) 1 +set profile(LOC,recentNews) {} +set profile(LOC,smallSetUpperBound) 0 +set profile(LOC,targetInfoName) {} +set profile(LOC,timeDefine) 983197488 +set profile(LOC,timeLastExplain) {} +set profile(LOC,timeLastInit) 983197499 +set profile(LOC,welcomeMessage) {} +set profile(LOC,windowNumber) 20 set {profile(OCLC First Search,authentication)} {} set {profile(OCLC First Search,comstack)} tcpip set {profile(OCLC First Search,databases)} {INSPEC HumanitiesIndex LibraryLiterature LegalPeriodicals MarcWorldCat Medline NewYorkTimes} diff --git a/msearch.tcl b/msearch.tcl new file mode 100755 index 0000000..256156b --- /dev/null +++ b/msearch.tcl @@ -0,0 +1,88 @@ +#!/usr/bin/tclsh +# $Id: msearch.tcl,v 1.1 2001-03-26 11:39:35 adam Exp $ +# Simple multi-target search + +if {[catch {ir-log-init all irtcl shell.log}]} { + set e [info sharedlibextension] + puts "Loading irtcl$e ..." + load ./irtcl$e irtcl + ir-log-init all irtcl shell.log +} + +proc msearch {targets query pending} { + global $pending + + set n 0 + foreach t $targets { + ir z.$n + z.$n databaseNames [lindex $t 1] + ir-set z.$n.1 z.$n + z.$n failback [list fail-response $targets $n $query $pending] + z.$n callback [list connect-response $targets $n $query $pending] + incr n + } + set n 0 + foreach t $targets { + if {[catch {z.$n connect [lindex $t 0]}]} { + fail-response $targets $n + } + incr n + } + set $pending $n +} + +proc fail-response {targets n query pending} { + global $pending + + puts "[lindex $targets $n]: failed" + incr $pending -1 +} + +proc connect-response {targets n query pending} { + global $pending + + puts "[lindex $targets $n]: connect response" + z.$n callback [list init-response $targets $n $query $pending] + if {[catch {z.$n init}]} { + incr $pending -1 + } +} + +proc init-response {targets n query pending} { + global $pending + + puts "[lindex $targets $n]: init response" + if {![z.$n initResult]} { + puts "connection rejected: [z.$n userInformationField]" + incr $pending -1 + } else { + z.$n callback [list search-response $targets $n $query $pending] + if {[catch {z.$n.1 search $query}]} { + puts "[lindex $targets $n]: bad query $query" + incr $pending -1 + } + } +} + +proc search-response {targets n query pending} { + global $pending + + puts "[lindex $targets $n]: search response" + set sstatus [z.$n.1 searchStatus] + if {$sstatus} { + set h [z.$n.1 resultCount] + puts "[lindex $targets $n]: search ok" + puts "[lindex $targets $n]: $h hits" + } else { + puts "[lindex $targets $n]: search failed" + } + incr $pending -1 +} + +msearch {{bagel.indexdata.dk gils} {localhost:9999 Default} {z3950.bell-labs.com books}} utah ok + +# This looping is optional if you're using Tk (X11) +while {$ok} { + vwait ok +} +puts "Finished searching" -- 1.7.10.4