From 366e11a6ab3c8cb8d12558ff1d76566c5ebca80e Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 15 Nov 2001 13:16:02 +0000 Subject: [PATCH] ZOOM: Separate get/set for dealing with options. --- include/yaz/zoom.h | 17 +++++++++++------ zoom/zoom-c.c | 31 ++++++++++++++++--------------- zoom/zoomtst2.c | 4 ++-- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/include/yaz/zoom.h b/include/yaz/zoom.h index baa1084..d1abf25 100644 --- a/include/yaz/zoom.h +++ b/include/yaz/zoom.h @@ -1,6 +1,6 @@ /* * Public header for ZOOM C. - * $Id: zoom.h,v 1.4 2001-11-15 08:58:29 adam Exp $ + * $Id: zoom.h,v 1.5 2001-11-15 13:16:02 adam Exp $ */ /* 1. Renamed type Z3950_search to Z3950_query and the functions @@ -49,10 +49,13 @@ void Z3950_connection_connect(Z3950_connection c, const char *host, ZOOM_EXPORT void Z3950_connection_destroy (Z3950_connection c); -/* set option for connection */ +/* get/set option for connection */ ZOOM_EXPORT -const char *Z3950_connection_option (Z3950_connection c, const char *key, - const char *val); +const char *Z3950_connection_option_get (Z3950_connection c, const char *key); + +ZOOM_EXPORT +void Z3950_connection_option_set (Z3950_connection c, const char *key, + const char *val); /* return host for connection */ ZOOM_EXPORT const char *Z3950_connection_host (Z3950_connection c); @@ -100,8 +103,10 @@ void Z3950_resultset_destroy(Z3950_resultset r); /* result set option */ ZOOM_EXPORT -const char *Z3950_resultset_option (Z3950_resultset r, const char *key, - const char *val); +const char *Z3950_resultset_option_get (Z3950_resultset r, const char *key); +ZOOM_EXPORT +void Z3950_resultset_option_set (Z3950_resultset r, const char *key, const char *val); + /* return size of result set (alias hit count AKA result count) */ ZOOM_EXPORT size_t Z3950_resultset_size (Z3950_resultset r); diff --git a/zoom/zoom-c.c b/zoom/zoom-c.c index fa38d1d..59ba765 100644 --- a/zoom/zoom-c.c +++ b/zoom/zoom-c.c @@ -1,5 +1,5 @@ /* - * $Id: zoom-c.c,v 1.6 2001-11-15 08:58:29 adam Exp $ + * $Id: zoom-c.c,v 1.7 2001-11-15 13:16:02 adam Exp $ * * ZOOM layer for C, connections, result sets, queries. */ @@ -1276,28 +1276,29 @@ static int do_write(Z3950_connection c) return do_write_ex (c, c->buf_out, c->len_out); } -const char *Z3950_connection_option (Z3950_connection c, const char *key, - const char *val) + +const char *Z3950_connection_option_get (Z3950_connection c, const char *key) { - if (val) - { - Z3950_options_set (c->options, key, val); - return val; - } return Z3950_options_get (c->options, key); } -const char *Z3950_resultset_option (Z3950_resultset r, const char *key, - const char *val) +void Z3950_connection_option_set (Z3950_connection c, const char *key, + const char *val) +{ + Z3950_options_set (c->options, key, val); +} + +const char *Z3950_resultset_option_get (Z3950_resultset r, const char *key) { - if (val) - { - Z3950_options_set (r->options, key, val); - return val; - } return Z3950_options_get (r->options, key); } +void Z3950_resultset_option_set (Z3950_resultset r, const char *key, + const char *val) +{ + Z3950_options_set (r->options, key, val); +} + int Z3950_connection_errcode (Z3950_connection c) { diff --git a/zoom/zoomtst2.c b/zoom/zoomtst2.c index ed0b82f..9dede46 100644 --- a/zoom/zoomtst2.c +++ b/zoom/zoomtst2.c @@ -1,5 +1,5 @@ /* - * $Id: zoomtst2.c,v 1.1 2001-10-23 21:00:20 adam Exp $ + * $Id: zoomtst2.c,v 1.2 2001-11-15 13:16:02 adam Exp $ * * Asynchronous single-target client performing search (no retrieval) */ @@ -28,7 +28,7 @@ int main(int argc, char **argv) z = Z3950_connection_create(0); /* option: set async operation */ - Z3950_connection_option (z, "async", "1"); + Z3950_connection_option_set (z, "async", "1"); /* connect to target and initialize */ Z3950_connection_connect (z, argv[1], 0); -- 1.7.10.4