From b443634fbd412cea15ea527188c3e241bb1edf21 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 8 Nov 1995 16:14:32 +0000 Subject: [PATCH] Many improvements and bug fixes. First version that ran on dtbsun. --- www/Makefile | 18 ++++++++++++------ www/mquery.egw | 6 +++--- www/msearch.egw | 6 +++--- www/mtargets.egw | 4 ++-- www/query.egw | 22 ++++++++++++++++------ www/search.egw | 15 +++++++-------- www/showfull.egw | 12 ++++++------ www/targets.egw | 4 ++-- www/wcgi.c | 30 ++++++++++++++++++++++++------ www/wtcl.c | 8 +++++++- www/z39util.tcl | 37 +++++++++++++++++++++++++------------ www/ztargets.conf | 6 +++--- 12 files changed, 110 insertions(+), 58 deletions(-) diff --git a/www/Makefile b/www/Makefile index beb9aeb..b522a08 100644 --- a/www/Makefile +++ b/www/Makefile @@ -2,7 +2,11 @@ # Europagate, 1995 # # $Log: Makefile,v $ -# Revision 1.11 1995/11/07 14:56:58 adam +# Revision 1.12 1995/11/08 16:14:32 adam +# Many improvements and bug fixes. +# First version that ran on dtbsun. +# +# Revision 1.11 1995/11/07 14:56:58 adam # Work on search in multiple targets. # New wtcl command: wlog. # Optional timeout parameter to zwait. @@ -46,7 +50,7 @@ SHELL=/bin/sh ZDEFS= ZINC=-I../../yaz/include ZLIB=../../yaz/lib/libyaz.a -MOSILIB=../../xtimosi/src/libmosi.a ../../yaz/lib/librfc.a +#MOSILIB=../../xtimosi/src/libmosi.a ../../yaz/lib/librfc.a LIBIRTCL=/usr/local/lib/libirtcl.a $(ZLIB) $(MOSILIB) # OLIB=../lib/util.a ../lib/libres+log.a @@ -80,7 +84,8 @@ $(TPROG1): $(P1) $(CC) $(CFLAGS) -o $(TPROG1) $(P1) $(OLIB) $(TPROG2): $(P2) - $(CC) $(CFLAGS) -o $(TPROG2) $(P2) $(OLIB) $(LIBIRTCL) $(TCLLIB) -lm + $(CC) $(CFLAGS) -o $(TPROG2) $(P2) $(OLIB) $(LIBIRTCL) \ + $(NETLIB) $(TCLLIB) -lm $(TPROG3): $(P3) $(CC) $(CFLAGS) -o $(TPROG3) $(P3) $(OLIB) @@ -93,9 +98,10 @@ install.prog: $(TPROG1) $(TPROG2) cp $$x $(CGIBIN); \ chmod +x $(CGIBIN)/$$x; \ done; \ - ln -f $(CGIBIN)/$(TPROG2) $(CGIBIN)/egwtcl; \ - ln -f $(CGIBIN)/$(TPROG2) $(CGIBIN)/egwirtcl; \ - ln -f $(CGIBIN)/$(TPROG2) $(CGIBIN)/egwhtml + for p in egwtcl egwirtcl egwhtml; do \ + rm -f $(CGIBIN)/$$p; \ + ln $(CGIBIN)/$(TPROG2) $(CGIBIN)/$$p; \ + done install.script: @for x in $(WSCRIPTS); do \ diff --git a/www/mquery.egw b/www/mquery.egw index 27e6e32..051dc91 100644 --- a/www/mquery.egw +++ b/www/mquery.egw @@ -4,7 +4,7 @@ { -# $Id: mquery.egw,v 1.1 1995/11/07 14:56:58 adam Exp $ +# $Id: mquery.egw,v 1.2 1995/11/08 16:14:32 adam Exp $ if {[info commands saveState] == ""} { source z39util.tcl @@ -14,7 +14,7 @@ global nextSetNo global hist - html {
} \n if {[catch {set setNo $nextSetNo}]} { @@ -74,7 +74,7 @@ and will continue to be so until the end of December 1995.
{ - html { New target } } { diff --git a/www/msearch.egw b/www/msearch.egw index 1d1238e..7f41697 100644 --- a/www/msearch.egw +++ b/www/msearch.egw @@ -1,6 +1,6 @@ { -# $Id: msearch.egw,v 1.1 1995/11/07 14:56:58 adam Exp $ +# $Id: msearch.egw,v 1.2 1995/11/08 16:14:33 adam Exp $ if {[info commands saveState] == ""} { source z39util.tcl @@ -63,9 +63,9 @@
{ - html { New target } " | \n" - html { New query } } diff --git a/www/mtargets.egw b/www/mtargets.egw index 6c91b03..095aa8a 100644 --- a/www/mtargets.egw +++ b/www/mtargets.egw @@ -1,6 +1,6 @@ { -# $Id: mtargets.egw,v 1.2 1995/11/07 14:56:58 adam Exp $ +# $Id: mtargets.egw,v 1.3 1995/11/08 16:14:33 adam Exp $ set setNo 1 source /usr/local/etc/httpd/conf/ztargets.conf if {[info commands saveState] == ""} { @@ -15,7 +15,7 @@

Choose one or more Z39.50 targets:

{ - html {
} \n foreach t [array names targets] { html {\n" wabort } elseif {$sessionWait == 0} { - zwait sessionWait + if {[catch {zwait sessionWait 30}]} { + html "Cannot connect to target ${host}
\n" + html "\n" + z39 disconnect + wabort + } if {$sessionWait != 1} { html "Cannot connect to target ${host}
\n" html "\n" + z39 disconnect wabort } } @@ -69,7 +75,11 @@ proc ok-response {} { htmlr "" wabort } - zwait sessionWait + if {[catch {zwait sessionWait 60}]} { + htmlr "Cannot initialize with target ${host}
" + htmlr "" + wabort + } if {$sessionWait != "1"} { htmlr "Cannot initialize with target ${host}
" htmlr "" @@ -78,7 +88,7 @@ proc ok-response {} { } set databases [lindex $targets($host) 1] - html {} \n set nodb [llength $databases] if {$nodb > 1} { @@ -126,7 +136,7 @@ proc ok-response {} { }

Alternatively you can enter your query in - CCL here:
+ CCL here:


Various technical parameters:


@@ -150,7 +160,7 @@ and will continue to be so until the end of December 1995.
{ - html { New target } } { diff --git a/www/search.egw b/www/search.egw index ebd2e66..21af854 100644 --- a/www/search.egw +++ b/www/search.egw @@ -1,6 +1,6 @@ { -# $Id: search.egw,v 1.10 1995/11/08 12:42:17 adam Exp $ +# $Id: search.egw,v 1.11 1995/11/08 16:14:33 adam Exp $ proc buttons {setNo setMax startPos} { global sessionId @@ -9,12 +9,12 @@ proc buttons {setNo setMax startPos} { html "

\n" if {$setMax < [z39.$setNo resultCount]} { - html { Next } "| \n" } if {$startPos != "" && $startPos != "1"} { - html { 1} { html + [expr $startPos - $hist($setNo,maxPresent)] @@ -22,9 +22,9 @@ proc buttons {setNo setMax startPos} { } html {"> Prev } "| \n" } - html { New target } " | \n" - html { New query } "

\n" } @@ -37,13 +37,12 @@ proc buttons {setNo setMax startPos} { global setNo global hist - set oldHost $hist($setNo,host) - if {[wform menu1] == ""} { set setNo [lindex $sessionParms 0] } else { if {![info exists hist($nextSetNo,host)]} { - set hist($nextSetNo,host) $oldHost + set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication) + set hist($nextSetNo,host) $hist($setNo,host) } set setNo $nextSetNo html "using host " $hist($setNo,host) " { -# $Id: showfull.egw,v 1.5 1995/11/08 12:42:17 adam Exp $ +# $Id: showfull.egw,v 1.6 1995/11/08 16:14:34 adam Exp $ proc buttons {setNo no} { global sessionId @@ -9,23 +9,23 @@ proc buttons {setNo no} { html "

\n" if {$no < [z39.$setNo resultCount]} { - html { Next } "| \n" } if {$no > 1} { - html { Prev } "| \n" } - html { Result } "| \n" - html { New target } " | \n" - html { New query } "

\n" } diff --git a/www/targets.egw b/www/targets.egw index cf0232c..366e502 100644 --- a/www/targets.egw +++ b/www/targets.egw @@ -1,6 +1,6 @@ { -# $Id: targets.egw,v 1.6 1995/11/08 12:42:17 adam Exp $ +# $Id: targets.egw,v 1.7 1995/11/08 16:14:34 adam Exp $ source /usr/local/etc/httpd/conf/ztargets.conf if {[info commands saveState] == ""} { source z39util.tcl @@ -27,7 +27,7 @@ Consejo Superior de Investigaciones Científicas

{ foreach t [array names targets] { - html {
} [lindex $targets($t) 0] " \n" set desc [lindex $targets($t) 4] if {$desc != ""} { diff --git a/www/wcgi.c b/www/wcgi.c index 3a4dec6..be3cb96 100644 --- a/www/wcgi.c +++ b/www/wcgi.c @@ -41,7 +41,11 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wcgi.c,v $ - * Revision 1.7 1995/11/08 12:42:18 adam + * Revision 1.8 1995/11/08 16:14:35 adam + * Many improvements and bug fixes. + * First version that ran on dtbsun. + * + * Revision 1.7 1995/11/08 12:42:18 adam * Added descriptive text field in target info. * Added authentication field in target info. * @@ -119,6 +123,7 @@ static int spawn (char *sprog, int id) case 0: close (0); close (1); + close (2); gw_log (GW_LOG_DEBUG, prog, "execl %s", path); execl (path, sprog, 0); gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, prog, "execl %s", path); @@ -140,6 +145,7 @@ int main() char combuf[COMBUF]; int linein = -1, lineout, data, gw_id; + chdir ("/usr/local/etc/httpd/cgi-bin"); gw_log_init ("egw"); gw_log_file (GW_LOG_ALL, "/usr/local/etc/httpd/logs/egwcgi_log"); gw_log_level (GW_LOG_ALL); @@ -260,10 +266,22 @@ int main() *(p++) = '\0'; /* no envvars tranferred at present */ if ((t = getenv("CONTENT_LENGTH")) && (data = atoi(t)) > 0) { - if (read(0, p, data) < data) - { - gw_log (GW_LOG_FATAL, prog, "Failed to read input"); - fatal("Internal error in server"); + int j, i = 0; + while (i < data) + { + j = read(0, p + i, data - i); + if (j == -1) + { + gw_log (GW_LOG_ERRNO|GW_LOG_FATAL, prog, + "Failed to read input"); + fatal("Internal error in server"); + } + else if (j == 0) + { + gw_log (GW_LOG_ERRNO, prog, "Failed to read input"); + fatal("Internal error in server"); + } + i += j; } } p += data; @@ -283,7 +301,7 @@ int main() } gw_log (GW_LOG_DEBUG, prog, "Reading response"); -#if 0 +#if 1 while ((data = read(linein, combuf, COMBUF)) > 0) { gw_log (GW_LOG_DEBUG, prog, "Got %d bytes", data); diff --git a/www/wtcl.c b/www/wtcl.c index bb2c34d..fc641f9 100644 --- a/www/wtcl.c +++ b/www/wtcl.c @@ -41,7 +41,11 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wtcl.c,v $ - * Revision 1.9 1995/11/07 14:57:00 adam + * Revision 1.10 1995/11/08 16:14:35 adam + * Many improvements and bug fixes. + * First version that ran on dtbsun. + * + * Revision 1.9 1995/11/07 14:57:00 adam * Work on search in multiple targets. * New wtcl command: wlog. * Optional timeout parameter to zwait. @@ -270,6 +274,8 @@ static void *do_create (WCLIENT wcl, void *args) static void report_error (struct tcl_info *p, int errorLine, const char *pre, const char *msg) { + if (!msg) + msg = ""; gw_log (GW_LOG_WARN, mod, "%s %d %s", pre, errorLine, msg); wo_printf (p->wcl, "\n

\n" "%s %d
\n", pre, errorLine); diff --git a/www/z39util.tcl b/www/z39util.tcl index 20fcec2..5c81b13 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.4 1995/11/08 16:14:36 adam Exp $ # proc saveState {} { uplevel #0 { @@ -8,15 +8,14 @@ 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\}" } } close $f @@ -78,7 +77,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 +210,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 +242,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 +402,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 +430,7 @@ proc z39history {} { } html "

History

\n" for {set setNo 1} {$setNo < $nextSetNo} {incr setNo} { - html {
} [lindex $targets($hist($setNo,host)) 0] @@ -437,4 +450,4 @@ proc z39history {} { html "\n" } html "
\n" -} \ No newline at end of file +} diff --git a/www/ztargets.conf b/www/ztargets.conf index 41371f0..ef953d2 100644 --- a/www/ztargets.conf +++ b/www/ztargets.conf @@ -1,4 +1,4 @@ -# $Id: ztargets.conf,v 1.6 1995/11/08 12:42:18 adam Exp $ +# $Id: ztargets.conf,v 1.7 1995/11/08 16:14:36 adam Exp $ set commonFields { { Title {@attr 1=4} } { Author {@attr 1=1003} } @@ -9,8 +9,8 @@ set commonFields { } set targets(myriad.middlebury.edu) { - Myriad - Default + Midcat + MIDCAT { { Title {@attr 1=4} } { Author {@attr 1=1003} } { Abstract {@attr 1=62} } -- 1.7.10.4