* Copyright (C) 1995-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.312 2006-08-15 13:30:00 adam Exp $
+ * $Id: client.c,v 1.318 2006-11-08 08:55:50 adam Exp $
*/
/** \file client.c
* \brief yaz-client program
static void close_session (void);
-ODR getODROutputStream()
+ODR getODROutputStream(void)
{
return out;
}
conn = cs_create_host(arg, 1, &add);
if (!conn)
{
- printf ("Couldn't create comstack\n");
+ printf ("Could not resolve address %s\n", arg);
return 0;
}
#if YAZ_HAVE_XML2
if (cs_connect(conn, add) < 0)
{
printf ("error = %s\n", cs_strerror(conn));
- if (conn->cerrno == CSYSERR)
- {
- char msg[256];
- yaz_strerror(msg, sizeof(msg));
- printf ("%s\n", msg);
- }
cs_close(conn);
conn = 0;
return 0;
return session_connect(cur_host);
}
-void try_reconnect()
+void try_reconnect(void)
{
char* open_command;
if (record_schema)
sr->u.request->recordSchema = record_schema;
if (recordsyntax_size == 1 && recordsyntax_list[0] == VAL_TEXT_XML)
- sr->u.explain_request->recordPacking = "xml";
+ sr->u.request->recordPacking = "xml";
return send_srw(sr);
}
#endif
return 0;
}
-static Z_External *create_external_itemRequest()
+static Z_External *create_external_itemRequest(void)
{
struct ill_get_ctl ctl;
ILL_ItemRequest *req;
Z_ExtendedServicesRequest *req = apdu->u.extendedServicesRequest;
oident ItemOrderRequest;
+
+ req->referenceId = set_refid (out);
+
ItemOrderRequest.proto = PROTO_Z3950;
ItemOrderRequest.oclass = CLASS_EXTSERV;
ItemOrderRequest.value = VAL_ITEMORDER;
return 0;
}
-static int only_z3950()
+static int only_z3950(void)
{
if (!conn)
{
return 1;
else
{
+ char *asn_buf = 0;
int noread = 0;
char oid_str[51];
int oid_value_xmles = VAL_XMLES;
Z_APDU *apdu = zget_APDU(out, Z_APDU_extendedServicesRequest);
Z_ExtendedServicesRequest *req = apdu->u.extendedServicesRequest;
+
Z_External *ext = (Z_External *) odr_malloc(out, sizeof(*ext));
+ req->referenceId = set_refid (out);
req->taskSpecificParameters = ext;
ext->indirect_reference = 0;
ext->descriptor = 0;
printf("Bad OID: %s\n", oid_str);
return 0;
}
-
- if (parse_cmd_doc(&arg, out, (char **) &ext->u.single_ASN1_type->buf,
+
+ if (parse_cmd_doc(&arg, out, &asn_buf,
&ext->u.single_ASN1_type->len, 0) == 0)
return 0;
+
+ ext->u.single_ASN1_type->buf = (unsigned char *) asn_buf;
+
req->packageType = yaz_oidval_to_z3950oid(out, CLASS_EXTSERV,
oid_value_xmles);
return 1;
}
-void source_rcfile()
+void source_rcfile(void)
{
/* Look for a $HOME/.yazclientrc and source it if it exists */
struct stat statbuf;
{"attributeset", cmd_attributeset, "<attrset>",complete_attributeset,0,NULL},
{"querytype", cmd_querytype, "<type>",complete_querytype,0,NULL},
{"refid", cmd_refid, "<id>",NULL,0,NULL},
- {"itemorder", cmd_itemorder, "ill|item <itemno>",NULL,0,NULL},
+ {"itemorder", cmd_itemorder, "ill|item|xml <itemno>",NULL,0,NULL},
{"update", cmd_update, "<action> <recid> [<doc>]",NULL,0,NULL},
{"update0", cmd_update0, "<action> <recid> [<doc>]",NULL,0,NULL},
{"xmles", cmd_xmles, "<OID> <doc>",NULL,0,NULL},