* Copyright (c) 1995-2004, Index Data
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.225 2004-01-13 11:19:24 adam Exp $
+ * $Id: client.c,v 1.228 2004-01-27 21:22:43 adam Exp $
*/
#include <stdio.h>
static char *last_open_command = NULL;
static int auto_reconnect = 0;
static Odr_bitmask z3950_options;
+static int z3950_version = 3;
static char cur_host[200];
{
Z_APDU *apdu = zget_APDU(out, Z_APDU_initRequest);
Z_InitRequest *req = apdu->u.initRequest;
+ int i;
req->options = &z3950_options;
- ODR_MASK_SET(req->protocolVersion, Z_ProtocolVersion_1);
- ODR_MASK_SET(req->protocolVersion, Z_ProtocolVersion_2);
- ODR_MASK_SET(req->protocolVersion, Z_ProtocolVersion_3);
+ ODR_MASK_ZERO(req->protocolVersion);
+ for (i = 0; i<z3950_version; i++)
+ ODR_MASK_SET(req->protocolVersion, i);
*req->maximumRecordSize = 1024*kilobytes;
*req->preferredMessageSize = 1024*kilobytes;
static void render_initUserInfo(Z_OtherInformation *ui1);
static void render_diag(Z_DiagnosticFormat *diag);
-static void pr_opt(const char *opt)
+static void pr_opt(const char *opt, void *clientData)
{
printf (" %s", opt);
}
session_mem = odr_extract_mem(in);
session = res;
- for (ver = 0; ver<5; ver++)
+ for (ver = 0; ver < 8; ver++)
if (!ODR_MASK_GET(res->protocolVersion, ver))
break;
}
}
printf ("Options:");
- yaz_init_opt_decode(res->options, pr_opt);
+ yaz_init_opt_decode(res->options, pr_opt, 0);
printf ("\n");
if (ODR_MASK_GET(res->options, Z_Options_namedResultSets))
return 2;
}
-static void show_opt(const char *arg)
+static void show_opt(const char *arg, void *clientData)
{
printf ("%s ", arg);
}
+static int cmd_zversion(const char *arg)
+{
+ if (*arg && arg)
+ z3950_version = atoi(arg);
+ else
+ printf ("version is %d\n", z3950_version);
+ return 0;
+}
+
static int cmd_options(const char *arg)
{
if (*arg)
}
else
{
- yaz_init_opt_decode(&z3950_options, show_opt);
+ yaz_init_opt_decode(&z3950_options, show_opt, 0);
printf ("\n");
}
return 0;
for (i = 0; i<res->num_diagnostics; i++)
{
- printf ("SRW diagnostic %d %s\n",
- *res->diagnostics[i].code,
- yaz_diag_srw_str(*res->diagnostics[i].code));
-
+ printf ("SRW diagnostic %s\n",
+ res->diagnostics[i].code);
+ if (res->diagnostics[i].message)
+ printf ("Message: %s\n", res->diagnostics[i].message);
if (res->diagnostics[i].details)
printf ("Details: %s\n", res->diagnostics[i].details);
}
{"adm-startup", cmd_adm_startup, "",NULL,0,NULL},
{"explain", cmd_explain, "", NULL, 0, NULL},
{"options", cmd_options, "", NULL, 0, NULL},
+ {"zversion", cmd_zversion, "", NULL, 0, NULL},
{"help", cmd_help, "", NULL,0,NULL},
{0,0,0,0,0,0}
};