From 7f332a840baf336e34d612cdee0ef27901f0dd11 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 26 Feb 2001 14:32:36 +0000 Subject: [PATCH] Updated for YAZ 1.7. HTML output tidy up. Added LOC target. --- CHANGELOG.email | 4 +- CHANGELOG.web | 4 +- Makefile.email | 8 +- Makefile.web | 9 +- doc/Makefile | 12 +-- doc/egate.sgml | 18 ++-- doc/web.sgml | 15 ++- fml/fmlmarc.c | 4 + fml/fmlstr.c | 4 + fml/fmlsym.c | 4 + include/zaccess.h | 6 +- kernel/bagel.res | 7 ++ kernel/default.res | 5 +- kernel/dimitris.res | 8 -- kernel/loc.bib | 4 +- kernel/loc.res | 8 +- kernel/main.c | 7 +- kernel/urp.c | 70 +++++++------- www/egwindex.html | 14 +-- www/egwscript | 4 +- www/mquery.egw | 4 +- www/mtargets.egw | 4 +- www/nwi.egw | 6 +- www/query.egw | 4 +- www/search.egw | 12 +-- www/showfull.egw | 8 +- www/targets.egw | 4 +- www/tform.egw | 4 +- www/wcgi.c | 4 + www/wsh.c | 5 + www/z39util.tcl | 40 ++++---- www/ztargets.conf | 25 +---- zlayer-yaz/zaccess.c | 246 ++++++++++++++++++++++++++++---------------------- 33 files changed, 320 insertions(+), 261 deletions(-) create mode 100644 kernel/bagel.res delete mode 100644 kernel/dimitris.res diff --git a/CHANGELOG.email b/CHANGELOG.email index a21a5d1..2f91775 100644 --- a/CHANGELOG.email +++ b/CHANGELOG.email @@ -1,4 +1,6 @@ -$Id: CHANGELOG.email,v 1.1 1996/09/03 14:06:37 adam Exp $ +$Id: CHANGELOG.email,v 1.2 2001/02/26 14:32:36 adam Exp $ 09/03/96 Release: 1.0. --------------------------------------------------------------------- + +02/26/01 Updated gateway for YAZ version 1.7. diff --git a/CHANGELOG.web b/CHANGELOG.web index e66d8e4..dc8683b 100644 --- a/CHANGELOG.web +++ b/CHANGELOG.web @@ -1,4 +1,4 @@ -$Id: CHANGELOG.web,v 1.6 1997/12/15 15:05:14 adam Exp $ +$Id: CHANGELOG.web,v 1.7 2001/02/26 14:32:36 adam Exp $ 09/03/96 Release: 1.0. --------------------------------------------------------------------- @@ -27,3 +27,5 @@ $Id: CHANGELOG.web,v 1.6 1997/12/15 15:05:14 adam Exp $ 12/15/97 Limit of form variables set to 4K instead of 512 bytes, and the code truncates larger buffers. + +02/26/01 Updated for YAZ version 1.7. diff --git a/Makefile.email b/Makefile.email index f7fc784..b751f19 100644 --- a/Makefile.email +++ b/Makefile.email @@ -1,14 +1,14 @@ # Top level Makefile for the Email - Z39.50 gateway # Europagate, 1995-1996. # -# $Id: Makefile.email,v 1.7 1997/02/19 16:47:03 adam Exp $ +# $Id: Makefile.email,v 1.8 2001/02/26 14:32:36 adam Exp $ # SHELL=/bin/sh MAKE=make #CC=cc CPP=$(CC) -E -VERSION=1.1 +VERSION=1.2 # Email gateway settings -------------------------------------- @@ -25,7 +25,7 @@ EMAILLIBDIR=/usr/local/lib/emailgw # If you are using YAZ uncomment these lines ZACC=zlayer-yaz ZINC=-I../../yaz/include -ZLIB=../../yaz/lib/libyaz.a +ZLIB=../../yaz/lib/.libs/libyaz.a ZDEFS= # If you are using Zdist uncomment these lines @@ -102,4 +102,4 @@ distribution: cd tmp/email-z39-$(VERSION)/doc; rm web.sgml; make egate cd tmp; tar zcf ../email-z39-$(VERSION).tar.gz email-z39-$(VERSION) rm -fr tmp - + diff --git a/Makefile.web b/Makefile.web index 98e5bbb..8ebd048 100644 --- a/Makefile.web +++ b/Makefile.web @@ -1,23 +1,23 @@ # Top level Makefile for the Web - Z39.50 gateway # Europagate, 1995-1996. # -# $Id: Makefile.web,v 1.9 2001/02/26 10:35:39 adam Exp $ +# $Id: Makefile.web,v 1.10 2001/02/26 14:32:36 adam Exp $ # SHELL=/bin/sh MAKE=make #CC=cc CPP=$(CC) -E -VERSION=1.1 +VERSION=1.2 # Install directories -HTTPDDIR=/var/lib/httpd +HTTPDDIR=/home/adam/proj/apache CGIDIR=$(HTTPDDIR)/cgi-bin HTDOCS=$(HTTPDDIR)/htdocs EGWDIR=$(HTTPDDIR)/egw GIFDIR=$(HTDOCS)/egwgif -EGWUSER=nobody +EGWUSER=adam # Location of Tcl TCLLIB=-ltcl8.3 -lm @@ -95,4 +95,3 @@ distribution: cd tmp/web-z39-$(VERSION)/doc; rm egate.sgml; make web cd tmp; tar zcf ../web-z39-$(VERSION).tar.gz web-z39-$(VERSION) rm -fr tmp - diff --git a/doc/Makefile b/doc/Makefile index fefba82..206759e 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.5 1996/08/28 08:23:26 adam Exp $ +# $Id: Makefile,v 1.6 2001/02/26 14:32:36 adam Exp $ all: egate.ps egate.txt egate.html egate: egate.txt egate.ps egate.html @@ -7,10 +7,10 @@ egate.txt: egate.sgml sgml2txt egate.sgml egate.dvi: egate.sgml - sgml2ps -d egate.sgml + sgml2latex egate -egate.ps: egate.sgml - sgml2ps egate.sgml +egate.ps: egate.dvi + dvips -t a4 egate -o egate.ps egate.html: egate.sgml sgml2html egate.sgml @@ -21,10 +21,10 @@ web.txt: web.sgml sgml2txt web.sgml web.dvi: web.sgml - sgml2ps -d web.sgml + sgml2latex web.sgml web.ps: web.sgml - sgml2ps web.sgml + dvips -t a4 web -o web.ps web.html: web.sgml sgml2html web.sgml diff --git a/doc/egate.sgml b/doc/egate.sgml index 230c1e3..acc7860 100644 --- a/doc/egate.sgml +++ b/doc/egate.sgml @@ -1,14 +1,14 @@
Email - Z39.50 gateway guide <author>Europagate, 1996 <htmlurl url="http://europagate.dtv.dk" name="http://europagate.dtv.dk"> -<date>$Revision: 1.13 $ +<date>$Revision: 1.14 $ <abstract> This document describes a Email server that provides access to the Z39.50 protocol. @@ -52,8 +52,8 @@ to build the zdist software in the directory <tt/libz3950/. YAZ can be found at the FTP host: -<htmlurl url="ftp://ftp.indexdata.dk/index/yaz" - name="ftp://ftp.indexdata.dk/index/yaz"> +<htmlurl url="ftp://ftp.indexdata.dk/pub/yaz/" + name="ftp://ftp.indexdata.dk/pub/yaz/"> The ES also uses GNU's regex package to parse regular expressions. The ES has been tested with regex-0.12. Some systems, such as Linux, @@ -109,10 +109,10 @@ The mail system needs to know about the ES. Pick some name that serves as the ES user and edit <tt/aliases/ used by your mail system (usually <tt>usr/lib/aliases</tt>). Now add the following line: -<tt>es:"|/usr/local/lib/es/eti </tt><em>options</em><tt>"</tt> +<tt>es:"|/usr/local/lib/emailgw/eti </tt><em>options</em><tt>"</tt> In this example the mail user name is <tt/es/ and the EMAILLIBDIR is -<tt>/usr/local/lib/es</tt>. +<tt>/usr/local/lib/emailgw</tt>. The ES system can operate with or without the monitor. When using the monitor the number of simultanous running kernels can be @@ -129,7 +129,7 @@ start the monitor in one of your boot scripts (rc). For example this might be put in a boot script: <tscreen><verb> -(cd /usr/local/lib/es; ./monitor -d -l mon.log -- -d -l kernel.log &) +(cd /usr/local/lib/emailgw; ./monitor -d -l mon.log -- -d -l kernel.log &) </verb></tscreen> Here the monitor is started with the options <tt>-d -l mon.log</tt> @@ -138,7 +138,7 @@ kernel. In this mode, the eti should contact the monitor (and not the kernel), so the following might be put in the aliases file: <tscreen><verb> -es:"|/usr/local/lib/es/eti -c /usr/local/lib/es" +es:"|/usr/local/lib/emailgw/eti -c /usr/local/lib/emailgw" </verb></tscreen> The eti sets current directory to the path specified by option <tt>-c</tt>. @@ -151,7 +151,7 @@ The eti will contact the kernel directly. The following line could be put in your aliases file: <tscreen><verb> -es:"|/usr/local/lib/es/eti -c /usr/local/lib/es -- -d -l kernel.log" +es:"|/usr/local/lib/emailgw/eti -c /usr/local/lib/emailgw -- -d -l kernel.log" </verb></tscreen> <sect1>eti diff --git a/doc/web.sgml b/doc/web.sgml index 6433017..c56f103 100644 --- a/doc/web.sgml +++ b/doc/web.sgml @@ -1,14 +1,14 @@ <!doctype linuxdoc system> <!-- - $Id: web.sgml,v 1.5 1997/02/19 16:47:07 adam Exp $ + $Id: web.sgml,v 1.6 2001/02/26 14:32:36 adam Exp $ --> <article> <title>Web/Z39.50 gateway guide <author>Europagate, 1996 <htmlurl url="http://europagate.dtv.dk" name="http://europagate.dtv.dk"> -<date>$Revision: 1.5 $ +<date>$Revision: 1.6 $ <abstract> This document describes a Web server that provides access to the Z39.50 protocol. @@ -34,13 +34,18 @@ Z39.50 protocol. YAZ and IrTcl can be found at the FTP host: -<htmlurl url="ftp://ftp.indexdata.dk/index/yaz" - name="ftp://ftp.indexdata.dk/index/yaz"> +<htmlurl url="ftp://ftp.indexdata.dk/pub/yaz/" + name="ftp://ftp.indexdata.dk/pub/yaz/"> + +or via HTTP at: + +<htmlurl url="http://ftp.indexdata.dk/pub/yaz/" + name="http://ftp.indexdata.dk/pub/yaz/"> You also need the Tcl package which can be found at: <htmlurl url="ftp://ftp.sunlabs.com/pub/tcl" - name="ftp://ftp.sunlabs.com/pub/tcl"> + name="http://dev.scriptics.com/"> Unpack <tt>web-z39-...tar.gz</tt> and edit the top level <tt/Makefile/. Specify where the YAZ package can be found by setting diff --git a/fml/fmlmarc.c b/fml/fmlmarc.c index efce9b2..9992e7c 100644 --- a/fml/fmlmarc.c +++ b/fml/fmlmarc.c @@ -45,6 +45,9 @@ * FML interpreter. Europagate, 1995 * * $Log: fmlmarc.c,v $ + * Revision 1.7 2001/02/26 14:32:36 adam + * Updated for YAZ 1.7. HTML output tidy up. Added LOC target. + * * Revision 1.6 1995/05/16 09:39:33 adam * LICENSE. * @@ -68,6 +71,7 @@ #include <assert.h> #include <stdlib.h> #include <stdio.h> +#include <string.h> #include <fmlmarc.h> #include <iso2709.h> diff --git a/fml/fmlstr.c b/fml/fmlstr.c index 44b8d04..3ae3b9e 100644 --- a/fml/fmlstr.c +++ b/fml/fmlstr.c @@ -45,6 +45,9 @@ * FML interpreter. Europagate, 1995 * * $Log: fmlstr.c,v $ + * Revision 1.8 2001/02/26 14:32:36 adam + * Updated for YAZ 1.7. HTML output tidy up. Added LOC target. + * * Revision 1.7 1995/05/16 09:39:34 adam * LICENSE. * @@ -71,6 +74,7 @@ #include <assert.h> #include <stdlib.h> #include <stdio.h> +#include <string.h> #include "fmlp.h" diff --git a/fml/fmlsym.c b/fml/fmlsym.c index adbd0af..39a6700 100644 --- a/fml/fmlsym.c +++ b/fml/fmlsym.c @@ -45,6 +45,9 @@ * FML interpreter. Europagate, 1995 * * $Log: fmlsym.c,v $ + * Revision 1.6 2001/02/26 14:32:36 adam + * Updated for YAZ 1.7. HTML output tidy up. Added LOC target. + * * Revision 1.5 1995/05/16 09:39:34 adam * LICENSE. * @@ -63,6 +66,7 @@ #include <stdio.h> #include <stdlib.h> #include <assert.h> +#include <string.h> #include "fmlp.h" diff --git a/include/zaccess.h b/include/zaccess.h index 4a61968..27fdd06 100644 --- a/include/zaccess.h +++ b/include/zaccess.h @@ -45,6 +45,9 @@ * Europagate, 1995 * * $Log: zaccess.h,v $ + * Revision 1.14 2001/02/26 14:32:36 adam + * Updated for YAZ 1.7. HTML output tidy up. Added LOC target. + * * Revision 1.13 1995/05/16 09:39:40 adam * LICENSE. * @@ -108,7 +111,8 @@ typedef struct zass_record { ZASS_REC_UNKNOWN=-1, ZASS_REC_DIAG=0, - ZASS_REC_USMARC=10 + ZASS_REC_USMARC=10, + ZASS_REC_DANMARC=11 } which; /* 0 = diagnostic, others according to z3950v3 */ char *record; /* marc or other */ diff --git a/kernel/bagel.res b/kernel/bagel.res new file mode 100644 index 0000000..38a182c --- /dev/null +++ b/kernel/bagel.res @@ -0,0 +1,7 @@ +# Email gateway - resource for a specific target +# $Id: bagel.res,v 1.1 2001/02/26 14:32:36 adam Exp $ +gw.portno: 210 +gw.hostname: bagel.indexdata.dk +gw.description: Index Data Z39.50 server +gw.databases: gils marc + diff --git a/kernel/default.res b/kernel/default.res index 8dcd8a6..4981f71 100644 --- a/kernel/default.res +++ b/kernel/default.res @@ -1,5 +1,5 @@ # Email gateway - general kernel resources -# $Id: default.res,v 1.31 1996/02/12 10:04:51 adam Exp $ +# $Id: default.res,v 1.32 2001/02/26 14:32:36 adam Exp $ # # Important directories, programs, etc. gw.reply.mta: /usr/lib/sendmail @@ -23,8 +23,7 @@ gw.hostname: localhost gw.bibset: default.bib gw.target.loc: loc.res gw.target.drewdb: drewdb.res -gw.target.dimitris: dimitris.res -gw.target.danbib: dimitris.res +gw.target.bagel: bagel.res gw.databases: # Language definitions diff --git a/kernel/dimitris.res b/kernel/dimitris.res deleted file mode 100644 index e2ee296..0000000 --- a/kernel/dimitris.res +++ /dev/null @@ -1,8 +0,0 @@ -# Email gateway - resource for a specific target -# $Id: dimitris.res,v 1.1 1995/04/19 16:03:24 adam Exp $ -gw.portno: 210 -gw.hostname: dagwood.ucd.ie -gw.account: <<denmark>> -gw.description: Z39.50/SR Gateway to Danbib -gw.databases: danbib - diff --git a/kernel/loc.bib b/kernel/loc.bib index 884abbe..b22b51e 100644 --- a/kernel/loc.bib +++ b/kernel/loc.bib @@ -1,7 +1,7 @@ # Subset of bib-1 attributes map to CCL qualifiers for a target -# $Id: loc.bib,v 1.4 1995/02/23 08:32:16 adam Exp $ +# $Id: loc.bib,v 1.5 2001/02/26 14:32:36 adam Exp $ # -term s=pw +term s=pw u=1016 au u=1 s=pw pn u=1 s=pw cn u=2 s=pw diff --git a/kernel/loc.res b/kernel/loc.res index dc54ea2..75f6331 100644 --- a/kernel/loc.res +++ b/kernel/loc.res @@ -1,9 +1,9 @@ # Email gateway - resource for a specific target -# $Id: loc.res,v 1.4 1995/02/23 08:32:17 adam Exp $ +# $Id: loc.res,v 1.5 2001/02/26 14:32:36 adam Exp $ # See p. 40-43 in Europagate, Background Study, Part II -gw.portno: 210 -gw.hostname: IBM2.LOC.gov +gw.portno: 7090 +gw.hostname: z3950.loc.gov gw.description: LC Z39.50 Test Server Information, Library of Congress gw.bibset: loc.bib -gw.databases: BOOKS NAMES +gw.databases: voyager diff --git a/kernel/main.c b/kernel/main.c index f1f1694..aa00fce 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -45,6 +45,9 @@ * Europagate, 1995 * * $Log: main.c,v $ + * Revision 1.31 2001/02/26 14:32:36 adam + * Updated for YAZ 1.7. HTML output tidy up. Added LOC target. + * * Revision 1.30 1996/02/12 10:04:54 adam * The gateway doesn't try to reconnect if it is already known that * it will fail (connect_fail flag introduced). @@ -161,7 +164,7 @@ #include <strqueue.h> #include "kernel.h" -FILE *reply_fd = stdout; +FILE *reply_fd; struct gw_kernel_info info; @@ -180,6 +183,8 @@ static void kernel_events (struct str_queue *queue) int persist_flag; int stop_flag = 0; + reply_fd = stdout; + persist_flag = gw_res_bool (info.kernel_res, "gw.persist", 0); timeout = gw_res_int (info.kernel_res, "gw.timeout", 600); gw_log (GW_LOG_DEBUG, KERNEL_LOG, "event loop"); diff --git a/kernel/urp.c b/kernel/urp.c index d472c26..914e279 100644 --- a/kernel/urp.c +++ b/kernel/urp.c @@ -45,6 +45,9 @@ * Europagate, 1995 * * $Log: urp.c,v $ + * Revision 1.51 2001/02/26 14:32:36 adam + * Updated for YAZ 1.7. HTML output tidy up. Added LOC target. + * * Revision 1.50 1996/03/01 16:09:30 adam * New setting: gw.msg.replyto that sets Reply-To in user response. * @@ -747,40 +750,45 @@ static void present (const char *set, int offset, int number, continue; } } - if (record_log_fd != -1) - write (record_log_fd, pp->record, strlen(pp->record)); - rec = iso2709_cvt (pp->record); - if (rec) - { + if (pp->record) + { + if (record_log_fd != -1) + write (record_log_fd, pp->record, strlen(pp->record)); + rec = iso2709_cvt (pp->record); + if (rec) + { #if USE_FML - strcpy (format_str, - gw_res_get (info.kernel_res, - "gw.display.format", "")); - if (format_token) - { - len = format_token->len; - if (len >= sizeof(format_str)) - len = sizeof(format_str)-1; - memcpy (format_str, format_token->name, len); - format_str[len] = '\0'; - } - if (info.fml && *format_str && - (!strcmp (format_str, "0") || !strcmp (format_str, "1") - || !strcmp(format_str, "2"))) - { - arg_ar[0] = "\\f"; - arg_ar[1] = format_str; - arg_ar[2] = " \\list"; - arg_ar[3] = marc_to_str (info.fml, rec); - arg_ar[4] = NULL; - fml_exec_call_argv (info.fml, arg_ar); - } - else - iso2709_display (rec, reply_fd); + strcpy (format_str, + gw_res_get (info.kernel_res, + "gw.display.format", "")); + if (format_token) + { + len = format_token->len; + if (len >= sizeof(format_str)) + len = sizeof(format_str)-1; + memcpy (format_str, format_token->name, len); + format_str[len] = '\0'; + } + if (info.fml && *format_str && + (!strcmp (format_str, "0") || !strcmp (format_str, "1") + || !strcmp(format_str, "2"))) + { + arg_ar[0] = "\\f"; + arg_ar[1] = format_str; + arg_ar[2] = " \\list"; + arg_ar[3] = marc_to_str (info.fml, rec); + arg_ar[4] = NULL; + fml_exec_call_argv (info.fml, arg_ar); + } + else + iso2709_display (rec, reply_fd); #else - iso2709_display (rec, reply_fd); + iso2709_display (rec, reply_fd); #endif - iso2709_rm (rec); + iso2709_rm (rec); + } + else + fprintf (reply_fd, "Record type not supported\n"); } else fprintf (reply_fd, "Not a MARC record\n"); diff --git a/www/egwindex.html b/www/egwindex.html index 0923f4b..75ad988 100644 --- a/www/egwindex.html +++ b/www/egwindex.html @@ -3,28 +3,28 @@ <title>Europagate WWW index test page -

Europagate WWW index test page, $Revision: 1.14 $

+

Europagate WWW index test page, $Revision: 1.15 $

diff --git a/www/egwscript b/www/egwscript index 4a192ee..eb7257d 100644 --- a/www/egwscript +++ b/www/egwscript @@ -1,5 +1,5 @@ -Europgate WWW gateway test script $Id: egwscript,v 1.2 1995/10/23 16:55:35 adam Exp $ +Europgate WWW gateway test script $Id: egwscript,v 1.3 2001/02/26 14:32:36 adam Exp $ Test script with embedded Tcl.

{ @@ -10,7 +10,7 @@ Test script with embedded Tcl.

session Id: {html $sessionId}
session Parms: {html $sessionParms}
Click - + here to go to this page again.
Number of times this page has been referenced: {html $count}

diff --git a/www/mquery.egw b/www/mquery.egw index 849afba..ba50759 100644 --- a/www/mquery.egw +++ b/www/mquery.egw @@ -1,6 +1,6 @@ { -# $Id: mquery.egw,v 1.17 1996/10/11 13:16:34 adam Exp $ +# $Id: mquery.egw,v 1.18 2001/02/26 14:32:36 adam Exp $ if {[info commands saveState] == ""} { source z39util.tcl @@ -26,7 +26,7 @@ button-main button-new-target - html {

} \n set phost {} diff --git a/www/mtargets.egw b/www/mtargets.egw index a1f9341..8fd11f2 100644 --- a/www/mtargets.egw +++ b/www/mtargets.egw @@ -1,6 +1,6 @@ { -# $Id: mtargets.egw,v 1.23 1996/08/28 09:36:02 adam Exp $ +# $Id: mtargets.egw,v 1.24 2001/02/26 14:32:36 adam Exp $ set setNo 1 source ztargets.conf if {![info exists debug]} { @@ -40,7 +40,7 @@ button-define-target html "

Choose one or more targets

\n" - html {
} \n html "
\n" diff --git a/www/nwi.egw b/www/nwi.egw index c7eaecb..c8f26fa 100644 --- a/www/nwi.egw +++ b/www/nwi.egw @@ -1,6 +1,6 @@ { -# $Id: nwi.egw,v 1.7 1996/05/22 16:50:26 adam Exp $ +# $Id: nwi.egw,v 1.8 2001/02/26 14:32:36 adam Exp $ source ztargets.conf set scriptQuery nwi.egw @@ -68,7 +68,7 @@ set curEntry $hist($initSet,form,entry1) } } - html {} \n html "
" @@ -118,7 +118,7 @@ html "\n


\n" if {0} { - html {} \n } diff --git a/www/query.egw b/www/query.egw index b421710..cd40d69 100644 --- a/www/query.egw +++ b/www/query.egw @@ -1,6 +1,6 @@ { -# $Id: query.egw,v 1.40 1996/05/24 11:16:01 adam Exp $ +# $Id: query.egw,v 1.41 2001/02/26 14:32:36 adam Exp $ if {[info commands saveState] == ""} { source z39util.tcl @@ -118,7 +118,7 @@ proc ok-response {} { set databaseDefault $hist($oSetNo,0,database) } - html {} \n set nodb [llength $databases] if {$nodb > 1} { diff --git a/www/search.egw b/www/search.egw index a4416d7..e526ebd 100644 --- a/www/search.egw +++ b/www/search.egw @@ -1,6 +1,6 @@ { -# $Id: search.egw,v 1.40 1996/05/15 18:43:38 adam Exp $ +# $Id: search.egw,v 1.41 2001/02/26 14:32:36 adam Exp $ proc start-scan {scanNo targetNo cache dir initSet} { global sessionId @@ -42,7 +42,7 @@ proc start-scan {scanNo targetNo cache dir initSet} { if {!$useIcons} { html "\n | " } - html {} if {$useIcons} { @@ -55,7 +55,7 @@ proc start-scan {scanNo targetNo cache dir initSet} { if {!$useIcons} { html "\n | " } - html {} if {$useIcons} { @@ -78,7 +78,7 @@ proc start-scan {scanNo targetNo cache dir initSet} { set databaseDefault $hist($oSetNo,$targetNo,database) } - html {} \n set nodb [llength $databases] if {$nodb > 1} { @@ -140,7 +140,7 @@ proc start-scan {scanNo targetNo cache dir initSet} { if {!$useIcons} { html "\n | " } - html {} if {$useIcons} { @@ -153,7 +153,7 @@ proc start-scan {scanNo targetNo cache dir initSet} { if {!$useIcons} { html "\n | " } - html {} if {$useIcons} { diff --git a/www/showfull.egw b/www/showfull.egw index abd1277..191e1aa 100644 --- a/www/showfull.egw +++ b/www/showfull.egw @@ -1,6 +1,6 @@ { -# $Id: showfull.egw,v 1.24 1996/03/14 11:50:49 adam Exp $ +# $Id: showfull.egw,v 1.25 2001/02/26 14:32:36 adam Exp $ proc buttons {setNo tno no format count host after} { global sessionId @@ -14,7 +14,7 @@ proc buttons {setNo tno no format count host after} { if {!$useIcons} { html "\n | " } - html { { -# $Id: targets.egw,v 1.27 1996/08/28 09:36:02 adam Exp $ +# $Id: targets.egw,v 1.28 2001/02/26 14:32:36 adam Exp $ source ztargets.conf if {![info exists debug]} { if {[lindex $sessionParms 1] == "1"} { @@ -52,7 +52,7 @@ global env global sessionId - html {
} [lindex $targets($t) 0] html {} diff --git a/www/tform.egw b/www/tform.egw index bd0639f..8f2bd1a 100644 --- a/www/tform.egw +++ b/www/tform.egw @@ -1,6 +1,6 @@ { -# $Id: tform.egw,v 1.7 1996/08/28 09:36:03 adam Exp $ +# $Id: tform.egw,v 1.8 2001/02/26 14:32:36 adam Exp $ if {[info commands saveState] == ""} { source z39util.tcl @@ -17,7 +17,7 @@ button-new-target html "

Target definition form


\n" - html {} \n html "
" diff --git a/www/wcgi.c b/www/wcgi.c index a16fc6f..b97bbd4 100644 --- a/www/wcgi.c +++ b/www/wcgi.c @@ -41,6 +41,9 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wcgi.c,v $ + * Revision 1.20 2001/02/26 14:32:36 adam + * Updated for YAZ 1.7. HTML output tidy up. Added LOC target. + * * Revision 1.19 1997/01/24 13:13:10 adam * Implemnted egw_source and added a "raw" option to the URL. * Fixed a bug in the buffering system of wproto; the macro wo_putc could @@ -117,6 +120,7 @@ #include #include +#include #include #include #include diff --git a/www/wsh.c b/www/wsh.c index 9ee4a14..9992464 100644 --- a/www/wsh.c +++ b/www/wsh.c @@ -41,6 +41,9 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wsh.c,v $ + * Revision 1.14 2001/02/26 14:32:36 adam + * Updated for YAZ 1.7. HTML output tidy up. Added LOC target. + * * Revision 1.13 1996/02/29 15:36:34 adam * Main shell loop implemented as a separate function called wshmain. * @@ -91,6 +94,8 @@ */ #include +#include +#include #include "whtml.h" #include "wtcl.h" #include "wirtcl.h" diff --git a/www/z39util.tcl b/www/z39util.tcl index 5186f29..08398cf 100644 --- a/www/z39util.tcl +++ b/www/z39util.tcl @@ -1,5 +1,5 @@ # -# $Id: z39util.tcl,v 1.49 1997/11/19 13:29:13 adam Exp $ +# $Id: z39util.tcl,v 1.50 2001/02/26 14:32:36 adam Exp $ # proc saveState {} { uplevel #0 { @@ -87,7 +87,7 @@ proc display-medium {zset no setNo targetNo} { set rtype [$zset recordType $no] switch $rtype { SUTRS { - html { } html [join [$zset getSutrs $no]] html "
\n" @@ -109,7 +109,7 @@ proc display-medium {zset no setNo targetNo} { set year [$zset getMarc $no field 260 * c] set score [$zset getMarc $no field 999 * r] } dispError ] } { - html { } set p 0 foreach a $author { @@ -153,7 +153,7 @@ proc display-medium {zset no setNo targetNo} { html "; Score " $nscore } } else { - html { } html {No Title} html { } @@ -184,7 +184,7 @@ proc display-brief {zset no setNo targetNo} { set rtype [$zset recordType $no] switch $rtype { SUTRS { - html { } html [string range [join [$zset getSutrs $no]] 0 70] html "
\n" @@ -205,7 +205,7 @@ proc display-brief {zset no setNo targetNo} { set publisher [$zset getMarc $no field 260 * b] set year [$zset getMarc $no field 260 * c] } dispError ] } { - html { } set p 0 foreach a $author { @@ -253,7 +253,7 @@ proc display-brief {zset no setNo targetNo} { } html { } } else { - html { } html {No Title} html { } @@ -726,12 +726,12 @@ proc display-scan {setNo scanNo tno} { html {} if {0} { regsub -all {\ } [lindex [$zs scanLine $i] 1] + tterm - html {} } else { regsub -all {\ } [lindex [$zs scanLine $i] 1] + tterm - html {} } @@ -1190,7 +1190,7 @@ proc buttons-result-set-s {setNo targetNo setMax startPos after} { if {!$useIcons} { html "\n | " } - html {\n
NSD$code: $msg: $addinfo" } else { - html {
} html "

" [lindex $targets($hist($setNo,$i,host)) 0] ": " @@ -1458,7 +1458,7 @@ proc z39history {} { html {} } if {[info exists hist($setNo,$i,hits)]} { - html { } $hist($setNo,$i,hits) {} @@ -1474,7 +1474,7 @@ proc z39history {} { } else { html "
\n" } - html { } @@ -1550,7 +1550,7 @@ proc button-define-target {} { if {!$useIcons} { html "\n | " } - html {} if {$useIcons} { @@ -1631,7 +1631,7 @@ proc button-result-set {setNo tno} { if {!$useIcons} { html "\n | " } - html { 0} { html {/msearch.egw/} $setNo } else { @@ -1656,7 +1656,7 @@ proc button-scan-window {setNo} { html "\n | " } set targetNo 0 - html {} if {$useIcons} { html { - usgs: sample of USGS data directory
- esdd: additional Earch Science Data Directory records
- iah: data directory for the International Association of Hydrologists - } + {Zebra Z39.50 test server with GILS and MARC records
} 1 gils } @@ -149,8 +144,8 @@ set targets(161.253.225.10/UNICORN) [ list \ assorted \ ] -set targets(IBM2.LOC.GOV:2210/BOOKS) [ list \ - LOC,BOOKS \ +set targets(z3950.loc.gov:7090/voyager) [ list \ + LOCS \ {} \ $locFields \ {} \ @@ -159,16 +154,6 @@ set targets(IBM2.LOC.GOV:2210/BOOKS) [ list \ union \ ] -set targets(IBM2.LOC.GOV:2210/NAMES) [ list \ - LOC,NAMES \ - USMARC \ - $locFields \ - {} \ - {Library of Congress: Production file of name authority records} \ - 1 \ - union \ -] - set targets(199.92.147.99/Baystate) [list \ Baystate \ USMARC \ diff --git a/zlayer-yaz/zaccess.c b/zlayer-yaz/zaccess.c index 8d07fa6..e50435e 100644 --- a/zlayer-yaz/zaccess.c +++ b/zlayer-yaz/zaccess.c @@ -47,6 +47,9 @@ * Z39.50 API for the Email gateway - YAZ version * * $Log: zaccess.c,v $ + * Revision 1.6 2001/02/26 14:32:36 adam + * Updated for YAZ 1.7. HTML output tidy up. Added LOC target. + * * Revision 1.5 1996/01/03 08:58:12 adam * Updated to use new version of Yaz (some names changed to avoid C++ conflict). * @@ -104,13 +107,13 @@ #include #include -#include -#include -#include +#include +#include +#include #ifdef USE_XTIMOSI #include #endif -#include +#include #include #include @@ -148,7 +151,7 @@ static Z_APDU *get_apdu(struct zass *z, int *complete) } odr_reset(z->decode); odr_setbuf(z->decode, z->inbuf, res, 0); - if (!z_APDU(z->decode, &ap, 0)) + if (!z_APDU(z->decode, &ap, 0, 0)) { gw_log(GW_LOG_WARN, ZASS_TYPE, "decode: %s", odr_errlist[odr_geterror(z->decode)]); @@ -166,7 +169,7 @@ static int send_apdu(struct zass *z, Z_APDU *a) char *buf; int len; - if (!z_APDU(z->encode, &a, 0)) + if (!z_APDU(z->encode, &a, 0, 0)) { gw_log(GW_LOG_FATAL, ZASS_TYPE, "encoding initreq"); return -1; @@ -326,65 +329,72 @@ static Z_RPNStructure *rpn2rpn(ODR o, struct ccl_rpn_node *q) struct ccl_rpn_attr *i; int len; static int op[] = { Z_Operator_and, Z_Operator_or, Z_Operator_and_not }; + Z_AttributeElement **elements; + int num_attributes = 0; switch (q->kind) { - case CCL_RPN_TERM: - r->which = Z_RPNStructure_simple; - r->u.simple = odr_malloc(o, sizeof(Z_Operand)); - r->u.simple->which = Z_Operand_APT; - r->u.simple->u.attributesPlusTerm = t = odr_malloc(o, sizeof(*t)); - t->term = odr_malloc(o, sizeof(Z_Term)); - t->term->which = Z_Term_general; - t->term->u.general = odr_malloc(o, sizeof(Odr_oct)); - t->term->u.general->len = t->term->u.general->size = - strlen(q->u.t.term); - t->term->u.general->buf = odr_malloc(o, t->term->u.general->size); - memcpy(t->term->u.general->buf, q->u.t.term, - t->term->u.general->len); - t->num_attributes = 0; - t->attributeList = odr_malloc(o, sizeof(Z_AttributeElement*) * 100); - for (i = q->u.t.attr_list; i && t->num_attributes < 100; - i = i->next) - { - Z_AttributeElement *a; - - t->attributeList[t->num_attributes++] = a = - odr_malloc(o, sizeof(*a)); - a->attributeType = odr_malloc(o, sizeof(int)); - *a->attributeType = i->type; -#ifdef Z_95 - a->attributeSet = 0; - a->which = Z_AttributeValue_numeric; - a->value.numeric = odr_malloc(o, sizeof(*a->value.numeric)); - *a->value.numeric = i->value; + case CCL_RPN_TERM: + r->which = Z_RPNStructure_simple; + r->u.simple = odr_malloc(o, sizeof(Z_Operand)); + r->u.simple->which = Z_Operand_APT; + r->u.simple->u.attributesPlusTerm = t = odr_malloc(o, sizeof(*t)); + t->term = odr_malloc(o, sizeof(Z_Term)); + t->term->which = Z_Term_general; + t->term->u.general = odr_malloc(o, sizeof(Odr_oct)); + t->term->u.general->len = t->term->u.general->size = + strlen(q->u.t.term); + t->term->u.general->buf = odr_malloc(o, t->term->u.general->size); + memcpy(t->term->u.general->buf, q->u.t.term, + t->term->u.general->len); + elements = odr_malloc(o, sizeof(Z_AttributeElement*) * 100); +#ifdef ASN_COMPILED + t->attributes = (Z_AttributeList *) + odr_malloc (o, sizeof(*t->attributes)); + t->attributes->attributes = elements; #else - a->attributeValue = odr_malloc(o, sizeof(*a->attributeValue)); - *a->attributeValue = i->value; + t->attributeList = elements; #endif - } - return r; - case CCL_RPN_SET: - r->which = Z_RPNStructure_simple; - r->u.simple = odr_malloc(o, sizeof(Z_Operand)); - r->u.simple->which = Z_Operand_resultSetId; - r->u.simple->u.resultSetId = odr_malloc(o, len = - strlen(q->u.setname) + 1); - memcpy(r->u.simple->u.resultSetId, q->u.setname, len); - return r; - case CCL_RPN_AND: case CCL_RPN_OR: case CCL_RPN_NOT: - r->which = Z_RPNStructure_complex; - r->u.complex = odr_malloc(o, sizeof(Z_Complex)); - if (!(r->u.complex->s1 = rpn2rpn(o, q->u.p[0])) || - !(r->u.complex->s2 = rpn2rpn(o, q->u.p[1]))) - return 0; - r->u.complex->roperator = odr_malloc(o, sizeof(Z_Operator)); - r->u.complex->roperator->which = op[q->kind]; - r->u.complex->roperator->u.and = ""; - return r; - default: - gw_log(GW_LOG_FATAL, ZASS_TYPE, "Bad operator in RPN"); + for (i = q->u.t.attr_list; i && num_attributes < 100; i = i->next) + { + Z_AttributeElement *a; + + elements[num_attributes++] = a = + odr_malloc(o, sizeof(*a)); + a->attributeType = odr_malloc(o, sizeof(int)); + *a->attributeType = i->type; + a->attributeSet = 0; + a->which = Z_AttributeValue_numeric; + a->value.numeric = odr_malloc(o, sizeof(*a->value.numeric)); + *a->value.numeric = i->value; + } +#ifdef ASN_COMPILED + t->attributes->num_attributes = num_attributes; +#else + t->num_attributes = num_attributes; +#endif + return r; + case CCL_RPN_SET: + r->which = Z_RPNStructure_simple; + r->u.simple = odr_malloc(o, sizeof(Z_Operand)); + r->u.simple->which = Z_Operand_resultSetId; + r->u.simple->u.resultSetId = odr_malloc(o, len = + strlen(q->u.setname) + 1); + memcpy(r->u.simple->u.resultSetId, q->u.setname, len); + return r; + case CCL_RPN_AND: case CCL_RPN_OR: case CCL_RPN_NOT: + r->which = Z_RPNStructure_complex; + r->u.complex = odr_malloc(o, sizeof(Z_Complex)); + if (!(r->u.complex->s1 = rpn2rpn(o, q->u.p[0])) || + !(r->u.complex->s2 = rpn2rpn(o, q->u.p[1]))) return 0; + r->u.complex->roperator = odr_malloc(o, sizeof(Z_Operator)); + r->u.complex->roperator->which = op[q->kind]; + r->u.complex->roperator->u.op_and = ""; + return r; + default: + gw_log(GW_LOG_FATAL, ZASS_TYPE, "Bad operator in RPN"); + return 0; } } @@ -415,9 +425,14 @@ const struct zass_searchent *zass_searchresult(ZASS a, int *complete) else { oident *id; +#ifdef ASN_COMPILED + Z_DiagRec dr_info; + Z_DiagRec *dr = &dr_info; + dr_info.which = Z_DiagRec_defaultFormat; + dr_info.u.defaultFormat = res->records->u.nonSurrogateDiagnostic; +#else Z_DiagRec *dr = res->records->u.nonSurrogateDiagnostic; - -#ifdef Z_95 +#endif if (dr->which != Z_DiagRec_defaultFormat || !(id = oid_getentbyoid (dr->u.defaultFormat->diagnosticSetId)) || @@ -428,27 +443,28 @@ const struct zass_searchent *zass_searchresult(ZASS a, int *complete) else { r.errcode = *dr->u.defaultFormat->condition; - if (dr->u.defaultFormat->addinfo) +#ifdef ASN_COMPILED + switch (dr->u.defaultFormat->which) { - strncpy(r.errstring, dr->u.defaultFormat->addinfo, 512); + case Z_DefaultDiagFormat_v2Addinfo: + strncpy(r.errstring, dr->u.defaultFormat->u.v2Addinfo, + 512); r.errstring[511] = '\0'; + break; + case Z_DefaultDiagFormat_v3Addinfo: + strncpy(r.errstring, dr->u.defaultFormat->u.v3Addinfo, + 512); + r.errstring[511] = '\0'; + break; } - } #else - if (!(id = oid_getentbyoid(dr->diagnosticSetId)) || - id->class != CLASS_DIAGSET || id->value != VAL_BIB1) - gw_log(GW_LOG_WARN, ZASS_TYPE, - "Missing or unknown diagset - ignoring error!"); - else - { - r.errcode = *dr->condition; - if (dr->addinfo) + if (dr->u.defaultFormat->addinfo) { - strncpy(r.errstring, dr->addinfo, 512); + strncpy(r.errstring, dr->u.defaultFormat->addinfo, 512); r.errstring[511] = '\0'; } - } #endif + } } } return &r; @@ -526,33 +542,37 @@ const struct zass_searchent *zass_search(ZASS a, struct ccl_rpn_node *query, * Triple indirection - that's kinda heavy. We'll fix it later. * There are worse things around, though. Like ZDist. */ -void get_diagrec(zass_record ***p, Z_DiagRec *r) +void get_diagrecs(zass_record ***p, Z_DiagRec **r, int num) { **p = malloc(sizeof(***p)); (**p)->next = 0; -#ifdef Z_95 + (**p)->errstring[0] = '\0'; - if (r->which == Z_DiagRec_defaultFormat) + if ((*r)->which == Z_DiagRec_defaultFormat) { - (**p)->errcode = *r->u.defaultFormat->condition; - if (r->u.defaultFormat->addinfo) + (**p)->errcode = *(*r)->u.defaultFormat->condition; +#ifdef ASN_COMPILED + switch ((*r)->u.defaultFormat->which) + { + case Z_DefaultDiagFormat_v2Addinfo: + strncpy((**p)->errstring, (*r)->u.defaultFormat->u.v2Addinfo, 200); + (**p)->errstring[200] = 0; + break; + case Z_DefaultDiagFormat_v3Addinfo: + strncpy((**p)->errstring, (*r)->u.defaultFormat->u.v3Addinfo, 200); + (**p)->errstring[200] = 0; + break; + } +#else + if ((*r)->u.defaultFormat->addinfo) { - strncpy((**p)->errstring, r->u.defaultFormat->addinfo, 200); + strncpy((**p)->errstring, (*r)->u.defaultFormat->addinfo, 200); (**p)->errstring[200] = 0; } +#endif } else (**p)->errcode = -1; -#else - (**p)->errcode = *r->condition; - if (r->addinfo) - { - strncpy((**p)->errstring, r->addinfo, 200); - (**p)->errstring[200] = 0; - } - else - (**p)->errstring[0] = '\0'; -#endif (**p)->which = ZASS_REC_DIAG; *p = &(**p)->next; } @@ -567,7 +587,7 @@ void get_responserecords(zass_record ***p, Z_NamePlusRecordList *recs) record = recs->records[i]; if (record->which == Z_NamePlusRecord_surrogateDiagnostic) - get_diagrec(p, record->u.surrogateDiagnostic); + get_diagrecs(p, &record->u.surrogateDiagnostic, 1); else { Z_DatabaseRecord *r = record->u.databaseRecord; @@ -585,10 +605,11 @@ void get_responserecords(zass_record ***p, Z_NamePlusRecordList *recs) else switch (recform->value) { - case VAL_USMARC: (**p)->which = ZASS_REC_USMARC; break; - default: - gw_log(GW_LOG_WARN, ZASS_TYPE, "Unknown recsyn"); - (**p)->which = ZASS_REC_UNKNOWN; + case VAL_USMARC: (**p)->which = ZASS_REC_USMARC; break; + case VAL_DANMARC: (**p)->which = ZASS_REC_DANMARC; break; + default: + gw_log(GW_LOG_WARN, ZASS_TYPE, "Unknown recsyn"); + (**p)->which = ZASS_REC_UNKNOWN; } if (r->which != ODR_EXTERNAL_octet) { @@ -622,7 +643,7 @@ static int send_present(ZASS a, char *name, int start, int num, { Z_APDU *apdu; Z_PresentRequest *req; -#if 0 +#if 1 oident recsyn; #endif @@ -632,9 +653,9 @@ static int send_present(ZASS a, char *name, int start, int num, req->resultSetId = name; req->resultSetStartPoint = &start; req->numberOfRecordsRequested = # -#if 0 +#if 1 recsyn.proto = PROTO_Z3950; - recsyn.class = CLASS_RECSYN; + recsyn.oclass = CLASS_RECSYN; recsyn.value = form; req->preferredRecordSyntax = oid_getoidbyent(&recsyn); #else @@ -665,6 +686,9 @@ const struct zass_presentent *zass_present(ZASS a, char *resname, int start, { Z_APDU *apdu; Z_PresentResponse *res; +#ifdef ASN_COMPILED + Z_DiagRec dr, *dr_p = &dr; +#endif gw_log(ZASS_DEBUG, ZASS_TYPE, "Fetching %d records from # %d", num - r.num, start); @@ -694,16 +718,22 @@ const struct zass_presentent *zass_present(ZASS a, char *resname, int start, start = r.nextpos; switch (res->records->which) { - case Z_Records_DBOSD: - get_responserecords(&rec, - res->records->u.databaseOrSurDiagnostics); - break; - case Z_Records_NSD: - get_diagrec(&rec, res->records->u.nonSurrogateDiagnostic); - break; - default: - gw_log(GW_LOG_WARN, ZASS_TYPE, "Bad tag in response rec."); - return 0; + case Z_Records_DBOSD: + get_responserecords(&rec, + res->records->u.databaseOrSurDiagnostics); + break; + case Z_Records_NSD: +#ifdef ASN_COMPILED + dr.which = Z_DiagRec_defaultFormat; + dr.u.defaultFormat = res->records->u.nonSurrogateDiagnostic; + get_diagrecs(&rec, &dr_p, 1); +#else + get_diagrecs(&rec, &res->records->u.nonSurrogateDiagnostic, 1); +#endif + break; + default: + gw_log(GW_LOG_WARN, ZASS_TYPE, "Bad tag in response rec."); + return 0; } } while (num - r.num && start); -- 1.7.10.4