X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=1512e88732c25ecc3bc5b6259318ae1599719d48;hb=4ddee9959ca6f59d3f8bd4259dfecee04b12c925;hp=f320aecf6cb11f9cef9d75913c2d7a3e27d42a0b;hpb=cdf3162d32f13fd58d0b7fb06b3252bab2bc78ad;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index f320aec..1512e88 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: client.c,v 1.223 2004-01-07 21:02:42 adam Exp $ + * $Id: client.c,v 1.225 2004-01-13 11:19:24 adam Exp $ */ #include @@ -103,6 +103,7 @@ static FILE *marc_file = 0; static char *refid = NULL; static char *last_open_command = NULL; static int auto_reconnect = 0; +static Odr_bitmask z3950_options; static char cur_host[200]; @@ -280,14 +281,7 @@ static void send_initRequest(const char* type_and_host) Z_APDU *apdu = zget_APDU(out, Z_APDU_initRequest); Z_InitRequest *req = apdu->u.initRequest; - ODR_MASK_SET(req->options, Z_Options_search); - ODR_MASK_SET(req->options, Z_Options_present); - ODR_MASK_SET(req->options, Z_Options_namedResultSets); - ODR_MASK_SET(req->options, Z_Options_triggerResourceCtrl); - ODR_MASK_SET(req->options, Z_Options_scan); - ODR_MASK_SET(req->options, Z_Options_sort); - ODR_MASK_SET(req->options, Z_Options_extendedServices); - ODR_MASK_SET(req->options, Z_Options_delSet); + req->options = &z3950_options; ODR_MASK_SET(req->protocolVersion, Z_ProtocolVersion_1); ODR_MASK_SET(req->protocolVersion, Z_ProtocolVersion_2); @@ -332,6 +326,11 @@ static void send_initRequest(const char* type_and_host) static void render_initUserInfo(Z_OtherInformation *ui1); static void render_diag(Z_DiagnosticFormat *diag); +static void pr_opt(const char *opt) +{ + printf (" %s", opt); +} + static int process_initResponse(Z_InitResponse *res) { int ver = 0; @@ -376,46 +375,11 @@ static int process_initResponse(Z_InitResponse *res) } } printf ("Options:"); - if (ODR_MASK_GET(res->options, Z_Options_search)) - printf (" search"); - if (ODR_MASK_GET(res->options, Z_Options_present)) - printf (" present"); - if (ODR_MASK_GET(res->options, Z_Options_delSet)) - printf (" delSet"); - if (ODR_MASK_GET(res->options, Z_Options_resourceReport)) - printf (" resourceReport"); - if (ODR_MASK_GET(res->options, Z_Options_resourceCtrl)) - printf (" resourceCtrl"); - if (ODR_MASK_GET(res->options, Z_Options_accessCtrl)) - printf (" accessCtrl"); - if (ODR_MASK_GET(res->options, Z_Options_scan)) - printf (" scan"); - if (ODR_MASK_GET(res->options, Z_Options_sort)) - printf (" sort"); - if (ODR_MASK_GET(res->options, Z_Options_extendedServices)) - printf (" extendedServices"); - if (ODR_MASK_GET(res->options, Z_Options_level_1Segmentation)) - printf (" level1Segmentation"); - if (ODR_MASK_GET(res->options, Z_Options_level_2Segmentation)) - printf (" level2Segmentation"); - if (ODR_MASK_GET(res->options, Z_Options_concurrentOperations)) - printf (" concurrentOperations"); + yaz_init_opt_decode(res->options, pr_opt); + printf ("\n"); + if (ODR_MASK_GET(res->options, Z_Options_namedResultSets)) - { - printf (" namedResultSets"); setnumber = 0; - } - if (ODR_MASK_GET(res->options, Z_Options_encapsulation)) - printf (" encapsulation"); - if (ODR_MASK_GET(res->options, Z_Options_resultCount)) - printf (" resultCount"); - if (ODR_MASK_GET(res->options, Z_Options_negotiationModel)) - printf (" negotiationModel"); - if (ODR_MASK_GET(res->options, Z_Options_duplicateDetection)) - printf (" duplicateDetection"); - if (ODR_MASK_GET(res->options, Z_Options_queryType104)) - printf (" queryType104"); - printf ("\n"); if (ODR_MASK_GET(res->options, Z_Options_negotiationModel)) { @@ -2137,6 +2101,27 @@ static int cmd_itemorder(const char *arg) return 2; } +static void show_opt(const char *arg) +{ + printf ("%s ", arg); +} + +static int cmd_options(const char *arg) +{ + if (*arg) + { + int r; + int pos; + r = yaz_init_opt_encode(&z3950_options, arg, &pos); + } + else + { + yaz_init_opt_decode(&z3950_options, show_opt); + printf ("\n"); + } + return 0; +} + static int cmd_explain(const char *arg) { if (protocol != PROTO_HTTP) @@ -3813,6 +3798,7 @@ static struct { {"adm-shutdown", cmd_adm_shutdown, "",NULL,0,NULL}, {"adm-startup", cmd_adm_startup, "",NULL,0,NULL}, {"explain", cmd_explain, "", NULL, 0, NULL}, + {"options", cmd_options, "", NULL, 0, NULL}, {"help", cmd_help, "", NULL,0,NULL}, {0,0,0,0,0,0} }; @@ -4111,6 +4097,15 @@ int main(int argc, char **argv) #endif if (codeset) outputCharset = xstrdup(codeset); + + ODR_MASK_SET(&z3950_options, Z_Options_search); + ODR_MASK_SET(&z3950_options, Z_Options_present); + ODR_MASK_SET(&z3950_options, Z_Options_namedResultSets); + ODR_MASK_SET(&z3950_options, Z_Options_triggerResourceCtrl); + ODR_MASK_SET(&z3950_options, Z_Options_scan); + ODR_MASK_SET(&z3950_options, Z_Options_sort); + ODR_MASK_SET(&z3950_options, Z_Options_extendedServices); + ODR_MASK_SET(&z3950_options, Z_Options_delSet); while ((ret = options("k:c:q:a:b:m:v:p:u:t:Vxd:", argv, argc, &arg)) != -2) {