Possible compatibility problems with earlier versions marked with '*'.
+Documentation updates for COMSTACK.
+
+* ZOOM changes. Query object renamed from Z3950_search to Z3950_query.
+Changed prototype Z3950_records. For some functions int parameters
+were changed to size_t.
+
+TCP/IP COMSTACK no longer uses getprotobyname to avoid memory leak
+on some Unices.
+
New MARC decode/display function, marc_display_exl, which better rejects
bad ISO2709 records. YAZ client uses it.
<!ENTITY comstack "<acronym>COMSTACK</acronym>">
<!ENTITY zoom "<acronym>ZOOM</acronym>">
]>
-<!-- $Id: yaz.xml,v 1.12 2001-11-01 14:30:44 adam Exp $ -->
+<!-- $Id: yaz.xml,v 1.13 2001-11-06 17:05:19 adam Exp $ -->
<book id="yaz">
<bookinfo>
<title>YAZ User's Guide and Reference</title>
</copyright>
<abstract><simpara>
This document is the programmer's guide and reference to the &yaz;
- package version 1.8. &yaz; is a compact toolkit that provides
+ package version 1.8.2. &yaz; is a compact toolkit that provides
access to the Z39.50 protocol, as well as a set of higher-level
tools for implementing the server and client roles, respectively.
The documentation can be used on its own, or as a reference when
-<!-- $Id: zoom.xml,v 1.5 2001-10-26 20:13:44 adam Exp $ -->
+<!-- $Id: zoom.xml,v 1.6 2001-11-06 17:05:19 adam Exp $ -->
<chapter id="zoom"><title>Building clients with ZOOM</title>
<para>
non-<literal>NULL</literal>.
</para>
</sect1>
- <sect1 id="zoom.search"><title>Search objects</title>
+ <sect1 id="zoom.query"><title>Queries</title>
<para>
- Search objects defines how result sets are obtained. They
- act like queries.
+ Query objects represents queries.
</para>
<synopsis>
- Z3950_search Z3950_search_create(void);
+ Z3950_query Z3950_query_create(void);
- void Z3950_search_destroy(Z3950_search s);
+ void Z3950_query_destroy(Z3950_query q);
- int Z3950_search_prefix(Z3950_search s, const char *str);
+ int Z3950_query_prefix(Z3950_query q, const char *str);
- int Z3950_search_sortby(Z3950_search s, const char *criteria);
+ int Z3950_query_sortby(Z3950_query q, const char *criteria);
</synopsis>
<para>
- Create search objects using <function>Z3950_search_create</function>
- and destroy them by calling <function>Z3950_search_destroy</function>.
+ Create query objects using <function>Z3950_query_create</function>
+ and destroy them by calling <function>Z3950_query_destroy</function>.
RPN-queries can be specified in <link linkend="PQF">PQF</link>
notation by using the
- function <function>Z3950_search_prefix</function>. More
+ function <function>Z3950_query_prefix</function>. More
query types will be added later, such as
<link linkend="CCL">CCL</link> to RPN-mapping, native CCL query,
etc. In addition to a search, a sort criteria may be set. Function
- <function>Z3950_search_sortby</function> specifies a
+ <function>Z3950_query_sortby</function> specifies a
sort criteria using the same string notation for sort as offered by
the <link linkend="sortspec">YAZ client</link>.
</para>
</para>
<synopsis>
Z3950_resultset Z3950_connection_search(Z3950_connection,
- Z3950_search q);
+ Z3950_query q);
Z3950_resultset Z3950_connection_search_pqf(Z3950_connection c,
const char *q);
</synopsis>
<para>
Function <function>Z3950_connection_search</function> creates
- a result set given a connection - and search object.
+ a result set given a connection and query.
Destroy a result set by calling
<function>Z3950_resultset_destroy</function>.
- Simple clients using PQF only may use function
- <function>Z3950_connection_search_pqf</function> instead.
+ Simple clients may using PQF only may use function
+ <function>Z3950_connection_search_pqf</function> in which case
+ creating query objects is not necessary.
</para>
<synopsis>
const char *Z3950_resultset_option (Z3950_resultset r,
int Z3950_resultset_size (Z3950_resultset r);
- void *Z3950_resultset_get (Z3950_resultset s, int pos,
- const char *type, int *len);
+ void *Z3950_resultset_get (Z3950_resultset s, size_t pos,
+ const char *type, size_t *len);
</synopsis>
<para>
Function <function>Z3950_resultset_options</function> sets or
used in searches; false (0) if not.
</entry><entry>1</entry></row>
<row><entry>
- start</entry><entry>Offset of first record we wish to
- retrieve from the target. Note first record has offset 0
- unlike the protocol specifications where first record has position
- 1.
+ start</entry><entry>Offset of first record to be
+ retrieved from target. First record has offset 0 unlike the
+ protocol specifications where first record has position 1.
</entry><entry>0</entry></row>
<row><entry>
count</entry><entry>Number of records to be retrieved.
<literal>USMARC</literal>, <literal>SUTRS</literal>, etc.
</entry><entry>none</entry></row>
<row><entry>
+ smallSetUpperBound</entry><entry>If hits is less than or equal to this
+ value, then target will return all records using small element set name
+ </entry><entry>0</entry></row>
+ <row><entry>
+ largeSetLowerBound</entry><entry>If hits is greator than this value, the target
+ will return no records.
+ </entry><entry>1</entry></row>
+ <row><entry>
+ mediumSetPresentNumber</entry><entry>This value represents
+ the number of records to be returned as part of a search when when
+ hits is less than or equal to large set lower bound and if hits
+ is greator than small set upper bound.
+ </entry><entry>0</entry></row>
+ <row><entry>
+ smallSetElementSetName</entry><entry>
+ The element set name to be used for small result sets.
+ </entry><entry>none</entry></row>
+ <row><entry>
+ mediumSetElementSetName</entry><entry>
+ The element set name to be for medium-sized result sets.
+ </entry><entry>none</entry></row>
+ <row><entry>
databaseName</entry><entry>One or more database names
separated by character plus (<literal>+</literal>).
</entry><entry>Default</entry></row>
<synopsis>
void Z3950_resultset_records (Z3950_resultset r,
Z3950_record *recs,
- size_t *cnt);
- Z3950_record Z3950_resultset_record (Z3950_resultset s, int pos);
+ size_t start, size_t count);
+ Z3950_record Z3950_resultset_record (Z3950_resultset s, size_t pos);
void *Z3950_record_get (Z3950_record rec, const char *type,
- int *len);
+ size_t *len);
void Z3950_record_destroy (Z3950_record rec);
</synopsis>
</para>
<para>
Function <function>Z3950_resultset_records</function> retrieves
- a number of records from a result set. Options <literal>start</literal>
+ a number of records from a result set. Parameter <literal>start</literal>
and <literal>count</literal> specifies the range of records to
- be returned. Upon completion <literal>recs[0], ..recs[*cnt]</literal>
- holds record objects for the records. These array of records
+ be returned. Upon completion array <literal>recs[0], ..recs[count-1]</literal>
+ holds record objects for the records. The array of records
<literal>recs</literal> should be allocate prior to calling
- <function>Z3950_resultset_records</function>. Note that for
+ <function>Z3950_resultset_records</function>. Note that for those
records that couldn't be retrieved from the target
- <literal>recs[ ..]</literal> is <literal>NULL</literal>.
+ <literal>recs[ ..]</literal> is set to <literal>NULL</literal>.
</para>
<para id="zoom.record.get">
In order to extract information about a single record,
</sect1>
<sect1 id="zoom.options"><title>Options</title>
<para>
- Most objects in &zoom; allow you to specify options to change
- default behaviour. From an implementation point of view a set of options
- is just like an associate array / hash array, etc.
+ Most &zoom; objects provide a way to specify options to default behaviour.
+ From an implementation point of view a set of options is just like
+ an associate array / hash array, etc.
</para>
<synopsis>
Z3950_options Z3950_options_create (void);
/*
* Public header for ZOOM C.
- * $Id: zoom.h,v 1.2 2001-10-24 12:24:43 adam Exp $
+ * $Id: zoom.h,v 1.3 2001-11-06 17:05:19 adam Exp $
*/
-/* the types we use */
+/* 1. Modification
+ Renamed type Z3950_search to Z3950_query and the functions
+ that manipulate it..
+ Changed positions/sizes to be of type size_t rather than int.
+*/
#include <yaz/yconfig.h>
-YAZ_BEGIN_CDECL
+#define ZOOM_EXPORT YAZ_EXPORT
+#define ZOOM_BEGIN_CDECL YAZ_BEGIN_CDECL
+#define ZOOM_END_CDECL YAZ_END_CDECL
+
+ZOOM_BEGIN_CDECL
+
+/* ----------------------------------------------------------- */
+/* the types we use */
typedef struct Z3950_options_p *Z3950_options;
-typedef struct Z3950_search_p *Z3950_search;
+typedef struct Z3950_query_p *Z3950_query;
typedef struct Z3950_connection_p *Z3950_connection;
typedef struct Z3950_resultset_p *Z3950_resultset;
typedef struct Z3950_task_p *Z3950_task;
/* create connection, connect to host, if portnum is 0, then port is
read from host string (e.g. myhost:9821) */
-YAZ_EXPORT
+ZOOM_EXPORT
Z3950_connection Z3950_connection_new (const char *host, int portnum);
/* create connection, don't connect, apply options */
-YAZ_EXPORT
+ZOOM_EXPORT
Z3950_connection Z3950_connection_create (Z3950_options options);
/* connect given existing connection */
-YAZ_EXPORT
+ZOOM_EXPORT
void Z3950_connection_connect(Z3950_connection c, const char *host,
int portnum);
-/* destroy connection (close connection also *) */
-YAZ_EXPORT
+/* destroy connection (close connection also) */
+ZOOM_EXPORT
void Z3950_connection_destroy (Z3950_connection c);
/* set option for connection */
-YAZ_EXPORT
+ZOOM_EXPORT
const char *Z3950_connection_option (Z3950_connection c, const char *key,
const char *val);
/* return host for connection */
-YAZ_EXPORT
+ZOOM_EXPORT
const char *Z3950_connection_host (Z3950_connection c);
/* return error code (0 == success, failure otherwise). cp
holds error string on failure, addinfo holds addititional info (if any)
*/
-YAZ_EXPORT
+ZOOM_EXPORT
int Z3950_connection_error (Z3950_connection c, const char **cp,
const char **addinfo);
/* returns error code */
-YAZ_EXPORT
+ZOOM_EXPORT
int Z3950_connection_errcode (Z3950_connection c);
/* returns error message */
-YAZ_EXPORT
+ZOOM_EXPORT
const char *Z3950_connection_errmsg (Z3950_connection c);
/* returns additional info */
-YAZ_EXPORT
+ZOOM_EXPORT
const char *Z3950_connection_addinfo (Z3950_connection c);
#define Z3950_ERROR_NONE 0
/* result sets */
/* create result set given a search */
-YAZ_EXPORT
-Z3950_resultset Z3950_connection_search(Z3950_connection, Z3950_search q);
+ZOOM_EXPORT
+Z3950_resultset Z3950_connection_search(Z3950_connection, Z3950_query q);
/* create result set given PQF query */
-YAZ_EXPORT
+ZOOM_EXPORT
Z3950_resultset Z3950_connection_search_pqf(Z3950_connection c, const char *q);
/* destroy result set */
-YAZ_EXPORT
+ZOOM_EXPORT
void Z3950_resultset_destroy(Z3950_resultset r);
/* result set option */
-YAZ_EXPORT
+ZOOM_EXPORT
const char *Z3950_resultset_option (Z3950_resultset r, const char *key,
const char *val);
/* return size of result set (hit count, AKA resultCount) */
-YAZ_EXPORT
+ZOOM_EXPORT
int Z3950_resultset_size (Z3950_resultset r);
/* return record at pos (starting from ), render given spec in type */
-YAZ_EXPORT
-void *Z3950_resultset_get (Z3950_resultset s, int pos, const char *type,
- int *len);
+ZOOM_EXPORT
+void *Z3950_resultset_get (Z3950_resultset s, size_t pos, const char *type,
+ size_t *len);
/* retrieve records */
-YAZ_EXPORT
+ZOOM_EXPORT
void Z3950_resultset_records (Z3950_resultset r, Z3950_record *recs,
- size_t *cnt);
+ size_t start, size_t count);
/* return record object at pos. Returns 0 if unavailable */
-YAZ_EXPORT
-Z3950_record Z3950_resultset_record (Z3950_resultset s, int pos);
+ZOOM_EXPORT
+Z3950_record Z3950_resultset_record (Z3950_resultset s, size_t pos);
/* like Z3950_resultset_record - but never blocks .. */
-YAZ_EXPORT
-Z3950_record Z3950_resultset_record_immediate (Z3950_resultset s, int pos);
+ZOOM_EXPORT
+Z3950_record Z3950_resultset_record_immediate (Z3950_resultset s, size_t pos);
/* ----------------------------------------------------------- */
/* records */
/* Get record information, in a form given by type */
-YAZ_EXPORT
-void *Z3950_record_get (Z3950_record rec, const char *type, int *len);
+ZOOM_EXPORT
+void *Z3950_record_get (Z3950_record rec, const char *type, size_t *len);
/* Destroy record */
-YAZ_EXPORT
+ZOOM_EXPORT
void Z3950_record_destroy (Z3950_record rec);
/* ----------------------------------------------------------- */
/* searches */
/* create search object */
-YAZ_EXPORT
-Z3950_search Z3950_search_create(void);
+ZOOM_EXPORT
+Z3950_query Z3950_query_create(void);
/* destroy it */
-YAZ_EXPORT
-void Z3950_search_destroy(Z3950_search s);
+ZOOM_EXPORT
+void Z3950_query_destroy(Z3950_query s);
/* specify prefix query for search */
-YAZ_EXPORT
-int Z3950_search_prefix(Z3950_search s, const char *str);
+ZOOM_EXPORT
+int Z3950_query_prefix(Z3950_query s, const char *str);
/* specify sort criteria for search */
-YAZ_EXPORT
-int Z3950_search_sortby(Z3950_search s, const char *criteria);
+ZOOM_EXPORT
+int Z3950_query_sortby(Z3950_query s, const char *criteria);
/* ----------------------------------------------------------- */
/* options */
typedef const char *(*Z3950_options_callback)(void *handle, const char *name);
-YAZ_EXPORT
+ZOOM_EXPORT
Z3950_options_callback Z3950_options_set_callback (Z3950_options opt,
Z3950_options_callback c,
void *handle);
-YAZ_EXPORT
+ZOOM_EXPORT
Z3950_options Z3950_options_create (void);
-YAZ_EXPORT
+ZOOM_EXPORT
Z3950_options Z3950_options_create_with_parent (Z3950_options parent);
-YAZ_EXPORT
+ZOOM_EXPORT
const char *Z3950_options_get (Z3950_options opt, const char *name);
-YAZ_EXPORT
+ZOOM_EXPORT
void Z3950_options_set (Z3950_options opt, const char *name, const char *v);
-YAZ_EXPORT
+ZOOM_EXPORT
void Z3950_options_destroy (Z3950_options opt);
-YAZ_EXPORT
+ZOOM_EXPORT
int Z3950_options_get_bool (Z3950_options opt, const char *name, int defa);
-YAZ_EXPORT
+ZOOM_EXPORT
int Z3950_options_get_int (Z3950_options opt, const char *name, int defa);
-YAZ_EXPORT
+ZOOM_EXPORT
void Z3950_options_addref (Z3950_options opt);
/* ----------------------------------------------------------- */
events are pending. The positive integer specifies the
connection for which the event occurred. There's no way to get
the details yet, sigh. */
-YAZ_EXPORT
+ZOOM_EXPORT
int Z3950_event (int no, Z3950_connection *cs);
-YAZ_END_CDECL
+ZOOM_END_CDECL
/*
- * Copyright (C) 1994-2000, Index Data
+ * Copyright (C) 1994-2001, Index Data
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Log: xmalloc.c,v $
- * Revision 1.13 2001-09-30 20:10:28 adam
- * TRACE_MALLOC=1.
- *
- * Revision 1.12 2001/09/24 21:51:56 adam
- * New Z39.50 OID utilities: yaz_oidval_to_z3950oid, yaz_str_to_z3950oid
- * and yaz_z3950oid_to_str.
- *
- * Revision 1.11 2000/02/29 13:44:55 adam
- * Check for config.h (currently not generated).
- *
- * Revision 1.10 1999/11/30 13:47:12 adam
- * Improved installation. Moved header files to include/yaz.
- *
- * Revision 1.9 1999/09/10 08:58:32 adam
- * Set TRACE_XMALLOC to 1.
- *
- * Revision 1.8 1999/08/27 09:40:32 adam
- * Renamed logf function to yaz_log. Removed VC++ project files.
- *
- * Revision 1.7 1999/07/13 13:24:53 adam
- * Updated memory debugging memory allocatation routines.
- *
- * Revision 1.6 1998/02/11 11:53:36 adam
- * Changed code so that it compiles as C++.
- *
- * Revision 1.5 1997/10/31 12:20:09 adam
- * Improved memory debugging for xmalloc/nmem.c. References to NMEM
- * instead of ODR in n ESPEC-1 handling in source d1_espec.c.
- * Bug fix: missing fclose in data1_read_espec1.
- *
- * Revision 1.4 1996/07/03 13:21:36 adam
- * Function xfree_f checks for NULL pointer.
- *
- * Revision 1.3 1995/12/05 15:08:44 adam
- * Fixed verbose of xrealloc.
- *
- * Revision 1.2 1995/12/05 11:08:37 adam
- * More verbose malloc routines.
- *
- * Revision 1.1 1995/11/01 11:56:53 quinn
- * Added Xmalloc.
- *
- * Revision 1.6 1995/10/16 14:03:11 quinn
- * Changes to support element set names and espec1
- *
- * Revision 1.5 1995/09/04 12:34:06 adam
- * Various cleanup. YAZ util used instead.
- *
- * Revision 1.4 1994/10/05 10:16:16 quinn
- * Added xrealloc. Fixed bug in log.
- *
- * Revision 1.3 1994/09/26 16:31:37 adam
- * Added xcalloc_f.
- *
- * Revision 1.2 1994/08/18 08:23:26 adam
- * Res.c now use handles. xmalloc defines xstrdup.
- *
- * Revision 1.1 1994/08/17 13:37:54 adam
- * xmalloc.c added to util.
- *
+ * $Id: xmalloc.c,v 1.14 2001-11-06 17:05:19 adam Exp $
*/
#if HAVE_CONFIG_H
#include <yaz/log.h>
#include <yaz/xmalloc.h>
-#define TRACE_XMALLOC 1
+#define TRACE_XMALLOC 2
#if TRACE_XMALLOC > 1
/*
- * $Id: zoom-c.c,v 1.2 2001-10-24 12:24:43 adam Exp $
+ * $Id: zoom-c.c,v 1.3 2001-11-06 17:05:19 adam Exp $
*
* ZOOM layer for C, connections, result sets, queries.
*/
}
}
-Z3950_search Z3950_search_create(void)
+Z3950_query Z3950_query_create(void)
{
- Z3950_search s = xmalloc (sizeof(*s));
+ Z3950_query s = xmalloc (sizeof(*s));
s->refcount = 1;
s->query = 0;
return c->host_port;
}
-void Z3950_search_destroy(Z3950_search s)
+void Z3950_query_destroy(Z3950_query s)
{
if (!s)
return;
(s->refcount)--;
- yaz_log (LOG_DEBUG, "Z3950_search_destroy count=%d", s->refcount);
+ yaz_log (LOG_DEBUG, "Z3950_query_destroy count=%d", s->refcount);
if (s->refcount == 0)
{
odr_destroy (s->odr);
}
}
-int Z3950_search_prefix(Z3950_search s, const char *str)
+int Z3950_query_prefix(Z3950_query s, const char *str)
{
s->query = odr_malloc (s->odr, sizeof(*s->query));
s->query->which = Z_Query_type_1;
return 0;
}
-int Z3950_search_sortby(Z3950_search s, const char *criteria)
+int Z3950_query_sortby(Z3950_query s, const char *criteria)
{
s->sort_spec = yaz_sort_spec (s->odr, criteria);
if (!s->sort_spec)
Z3950_resultset Z3950_connection_search_pqf(Z3950_connection c, const char *q)
{
Z3950_resultset r;
- Z3950_search s = Z3950_search_create();
+ Z3950_query s = Z3950_query_create();
- Z3950_search_prefix (s, q);
+ Z3950_query_prefix (s, q);
r = Z3950_connection_search (c, s);
- Z3950_search_destroy (s);
+ Z3950_query_destroy (s);
return r;
}
-Z3950_resultset Z3950_connection_search(Z3950_connection c, Z3950_search q)
+Z3950_resultset Z3950_connection_search(Z3950_connection c, Z3950_query q)
{
Z3950_resultset r = Z3950_resultset_create ();
Z3950_task task;
rp = &(*rp)->next;
}
}
- Z3950_search_destroy (r->search);
+ Z3950_query_destroy (r->search);
Z3950_options_destroy (r->options);
odr_destroy (r->odr);
xfree (r);
}
void Z3950_resultset_records (Z3950_resultset r, Z3950_record *recs,
- size_t *cnt)
+ size_t start, size_t count)
{
int force_present = 0;
- int start, count;
if (!r)
return ;
- start = Z3950_options_get_int (r->options, "start", 0);
- count = Z3950_options_get_int (r->options, "count", 0);
- if (cnt && recs)
+ if (count && recs)
force_present = 1;
Z3950_resultset_retrieve (r, force_present, start, count);
if (force_present)
{
size_t i;
- for (i = 0; i< *cnt; i++)
+ for (i = 0; i< count; i++)
recs[i] = Z3950_resultset_record_immediate (r, i+start);
}
}
return nrec;
}
-Z3950_record Z3950_resultset_record_immediate (Z3950_resultset s, int pos)
+Z3950_record Z3950_resultset_record_immediate (Z3950_resultset s,size_t pos)
{
Z3950_record rec = record_cache_lookup (s, pos, 0);
if (!rec)
return Z3950_record_dup (rec);
}
-Z3950_record Z3950_resultset_record (Z3950_resultset r, int pos)
+Z3950_record Z3950_resultset_record (Z3950_resultset r, size_t pos)
{
Z3950_resultset_retrieve (r, 1, pos, 1);
return Z3950_resultset_record_immediate (r, pos);
xfree (rec);
}
-void *Z3950_record_get (Z3950_record rec, const char *type, int *len)
+void *Z3950_record_get (Z3950_record rec, const char *type, size_t *len)
{
Z_NamePlusRecord *npr;
if (!rec)
return 0;
}
-void *Z3950_resultset_get (Z3950_resultset s, int pos, const char *type,
- int *len)
+void *Z3950_resultset_get (Z3950_resultset s, size_t pos, const char *type,
+ size_t *len)
{
Z3950_record rec = record_cache_lookup (s, pos, 0);
return Z3950_record_get (rec, type, len);
/*
* Private C header for ZOOM C.
- * $Id: zoom-p.h,v 1.2 2001-10-24 12:24:43 adam Exp $
+ * $Id: zoom-p.h,v 1.3 2001-11-06 17:05:19 adam Exp $
*/
#include <yaz/proto.h>
#include <yaz/comstack.h>
#include <yaz/wrbuf.h>
#include <yaz/zoom.h>
-struct Z3950_search_p {
+struct Z3950_query_p {
Z_Query *query;
Z_SortKeySpecList *sort_spec;
int refcount;
struct Z3950_resultset_p {
Z_Query *r_query;
Z_SortKeySpecList *r_sort_spec;
- Z3950_search search;
+ Z3950_query search;
int refcount;
int size;
int start;
/*
- * $Id: zoomsh.c,v 1.2 2001-10-24 12:24:43 adam Exp $
+ * $Id: zoomsh.c,v 1.3 2001-11-06 17:05:19 adam Exp $
*
* ZOOM-C Shell
*/
Z3950_options_set (options, "count", count_str);
for (i = 0; i<MAX_CON; i++)
- Z3950_resultset_records (r[i], 0, 0);
+ Z3950_resultset_records (r[i], 0, atoi(start_str), atoi(count_str));
while (Z3950_event (MAX_CON, c))
;
Z3950_options options,
const char **args)
{
- Z3950_search s;
+ Z3950_query s;
int i;
- s = Z3950_search_create ();
- if (Z3950_search_prefix (s, *args))
+ s = Z3950_query_create ();
+ if (Z3950_query_prefix (s, *args))
{
fprintf (stderr, "Bad PQF: %s\n", *args);
return;
display_records (c[i], r[i], start, count);
}
}
- Z3950_search_destroy (s);
+ Z3950_query_destroy (s);
}
static void cmd_help (Z3950_connection *c, Z3950_resultset *r,
/*
- * $Id: zoomtst4.c,v 1.2 2001-10-24 21:35:46 adam Exp $
+ * $Id: zoomtst4.c,v 1.3 2001-11-06 17:05:19 adam Exp $
*
* Asynchronous multi-target going through proxy doing search and retrieve
* using present.
int no = argc-3;
Z3950_connection z[500]; /* allow at most 500 connections */
Z3950_resultset r[500]; /* and result sets .. */
- Z3950_search s;
+ Z3950_query q;
Z3950_options o = Z3950_options_create ();
if (argc < 4)
Z3950_options_set (o, "proxy", argv[1]);
/* create query */
- s = Z3950_search_create ();
- if (Z3950_search_prefix (s, argv[argc-1]))
+ q = Z3950_query_create ();
+ if (Z3950_query_prefix (q, argv[argc-1]))
{
printf ("bad PQF: %s\n", argv[argc-1]);
exit (1);
{
z[i] = Z3950_connection_create (o);
Z3950_connection_connect (z[i], argv[i+2], 0);
- r[i] = Z3950_connection_search (z[i], s);
+ r[i] = Z3950_connection_search (z[i], q);
}
/* network I/O */
}
/* destroy stuff and exit */
- Z3950_search_destroy (s);
+ Z3950_query_destroy (q);
for (i = 0; i<no; i++)
{
Z3950_resultset_destroy (r[i]);
/*
- * $Id: zoomtst5.c,v 1.2 2001-10-24 12:24:43 adam Exp $
+ * $Id: zoomtst5.c,v 1.3 2001-11-06 17:05:19 adam Exp $
*
* Asynchronous multi-target client doing search, sort and present
*/
int no = argc-3;
Z3950_connection z[500]; /* allow at most 500 connections */
Z3950_resultset r[500]; /* and result sets .. */
- Z3950_search s;
+ Z3950_query q;
Z3950_options o;
o = Z3950_options_create ();
Z3950_options_set (o, "elementSetName", "B");
/* create query */
- s = Z3950_search_create ();
- if (Z3950_search_prefix (s, argv[argc-2]))
+ q = Z3950_query_create ();
+ if (Z3950_query_prefix (q, argv[argc-2]))
{
printf ("bad PQF: %s\n", argv[argc-2]);
exit (1);
}
- if (Z3950_search_sortby (s, argv[argc-1]))
+ if (Z3950_query_sortby (q, argv[argc-1]))
{
printf ("bad sort spec: %s\n", argv[argc-1]);
exit (1);
{
z[i] = Z3950_connection_create (o);
Z3950_connection_connect (z[i], argv[i+1], 0);
- r[i] = Z3950_connection_search (z[i], s);
+ r[i] = Z3950_connection_search (z[i], q);
}
/* network I/O */
}
/* destroy stuff and exit */
- Z3950_search_destroy (s);
+ Z3950_query_destroy (q);
for (i = 0; i<no; i++)
{
Z3950_resultset_destroy (r[i]);
/*
- * $Id: zoomtst6.c,v 1.2 2001-10-24 12:24:43 adam Exp $
+ * $Id: zoomtst6.c,v 1.3 2001-11-06 17:05:19 adam Exp $
*
* Asynchronous multi-target client doing two searches
*/
Z3950_connection z[500]; /* allow at most 500 connections */
Z3950_resultset r1[500]; /* and result sets .. */
Z3950_resultset r2[500]; /* and result sets .. */
- Z3950_search s;
+ Z3950_query q;
Z3950_options o;
o = Z3950_options_create ();
Z3950_options_set (o, "elementSetName", "B");
/* create query */
- s = Z3950_search_create ();
- if (Z3950_search_prefix (s, argv[argc-2]))
+ q = Z3950_query_create ();
+ if (Z3950_query_prefix (q, argv[argc-2]))
{
printf ("bad PQF: %s\n", argv[argc-2]);
exit (2);
{
z[i] = Z3950_connection_create (o);
Z3950_connection_connect (z[i], argv[i+1], 0);
- r1[i] = Z3950_connection_search (z[i], s);
+ r1[i] = Z3950_connection_search (z[i], q);
}
- if (Z3950_search_prefix (s, argv[argc-1]))
+ if (Z3950_query_prefix (q, argv[argc-1]))
{
printf ("bad sort spec: %s\n", argv[argc-1]);
exit (2);
}
/* queue second search */
for (i = 0; i<no; i++)
- r2[i] = Z3950_connection_search (z[i], s);
+ r2[i] = Z3950_connection_search (z[i], q);
/* network I/O */
while (Z3950_event (no, z))
}
}
/* destroy stuff and exit */
- Z3950_search_destroy (s);
+ Z3950_query_destroy (q);
for (i = 0; i<no; i++)
{
Z3950_connection_destroy (z[i]);
/*
- * $Id: zoomtst7.c,v 1.2 2001-10-24 12:24:43 adam Exp $
+ * $Id: zoomtst7.c,v 1.3 2001-11-06 17:05:19 adam Exp $
*
* API test..
*/
Z3950_record recs[2];
size_t recs_count = 2;
char query[40];
- Z3950_search s = Z3950_search_create ();
+ Z3950_query s = Z3950_query_create ();
sprintf (query, "i%dr%d", i, j);
- if (Z3950_search_prefix (s, query))
+ if (Z3950_query_prefix (s, query))
{
printf ("bad PQF: %s\n", query);
exit (2);
r[j] = Z3950_connection_search (z, s); /* non-piggy */
- Z3950_options_set (o, "count", "2");
- Z3950_resultset_records (r[j], 0, 0); /* first two */
+ Z3950_resultset_records (r[j], recs, 0, 2); /* first two */
- Z3950_options_set (o, "start", "1");
- Z3950_options_set (o, "count", "2");
- Z3950_resultset_records (r[j], recs, &recs_count); /* third */
- Z3950_resultset_records (r[j], 0, 0); /* ignored */
+ Z3950_resultset_records (r[j], recs, 1, 2); /* third */
+ Z3950_resultset_records (r[j], recs, 0, 0); /* ignored */
if (Z3950_resultset_size (r[j]) > 2)
{
Z3950_record_destroy (recs[0]);
Z3950_record_destroy (recs[1]);
- Z3950_search_destroy (s);
+ Z3950_query_destroy (s);
putchar ('.');
if (block > 0)
for (i = 0; i<1; i++)
{
- Z3950_search s = Z3950_search_create ();
+ Z3950_query q = Z3950_query_create ();
char host[40];
printf ("session %2d", i+10);
}
Z3950_connection_destroy (z);
- Z3950_options_set (o, "count", "1");
for (j = 0; j < 10; j++)
{
- Z3950_resultset_records (r[j], 0, 0);
+ Z3950_resultset_records (r[j], 0, 0, 1);
if (block > 0)
while (Z3950_event (1, &z))
;
}
for (j = 0; j < 10; j++)
Z3950_resultset_destroy (r[j]);
- Z3950_search_destroy (s);
+ Z3950_query_destroy (q);
printf ("10 searches, 10 ignored presents done\n");
}
}