X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=a224fcd25b63c5d05f072853ced2c88186ccf3b4;hb=fc2093cfd23eda0ee8384b18dc7e7b8adffd073a;hp=f04179b2e22d1db0ef5411323faaf77de55ac95b;hpb=5f743e6b18587c2daae4fe9cee8cf991b7352d24;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index f04179b..a224fcd 100644 --- a/client/client.c +++ b/client/client.c @@ -4,7 +4,16 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: client.c,v $ - * Revision 1.89 1999-11-04 14:58:44 adam + * Revision 1.92 1999-12-21 16:24:48 adam + * More robust ISO2709 handling (in case of real bad formats). + * + * Revision 1.91 1999/12/16 23:36:19 adam + * Implemented ILL protocol. Minor updates ASN.1 compiler. + * + * Revision 1.90 1999/11/30 13:47:11 adam + * Improved installation. Moved header files to include/yaz. + * + * Revision 1.89 1999/11/04 14:58:44 adam * Added status elements for backend delete result set handler. * Updated delete result result set command for client. * @@ -298,21 +307,25 @@ #include #include -#include +#include -#include +#include #ifdef USE_XTIMOSI -#include +#include #endif -#include -#include -#include +#include +#include +#include -#include +#include + +#ifdef ASN_COMPILED +#include +#endif #if CCL2RPN -#include +#include #endif #if HAVE_READLINE_READLINE_H @@ -743,7 +756,13 @@ static void display_record(Z_DatabaseRecord *p) ent->value == VAL_HTML) print_record(octet_buf, p->u.octet_aligned->len); else - marc_display (octet_buf, NULL); + { + if (marc_display (octet_buf, NULL) <= 0) + { + printf ("ISO2709 decoding failed, dumping record as is:\n"); + print_record(octet_buf, p->u.octet_aligned->len); + } + } if (marcdump) fwrite (octet_buf, 1, p->u.octet_aligned->len, marcdump); } @@ -1193,6 +1212,46 @@ void process_ESResponse(Z_ExtendedServicesResponse *res) } } +#ifdef ASN_COMPILED +static Z_External *create_external_itemRequest() +{ + ILL_ItemRequest *req = ill_get_ItemRequest(out); + Z_External *r = 0; + + if (!ill_ItemRequest (out, &req, 0, 0)) + return 0; + else + { + oident oid; + int itemRequest_size = 0; + char *itemRequest_buf = odr_getbuf (out, &itemRequest_size, 0); + + oid.proto = PROTO_GENERAL; + oid.oclass = CLASS_GENERAL; + oid.value = VAL_ISO_ILL_1; + + r = (Z_External *) odr_malloc (out, sizeof(*r)); + r->direct_reference = odr_oiddup(out,oid_getoidbyent(&oid)); + r->indirect_reference = 0; + r->descriptor = 0; + r->which = Z_External_single; + + r->u.single_ASN1_type = (Odr_oct *) + odr_malloc (out, sizeof(*r->u.single_ASN1_type)); + r->u.single_ASN1_type->buf = odr_malloc (out, itemRequest_size); + r->u.single_ASN1_type->len = itemRequest_size; + r->u.single_ASN1_type->size = itemRequest_size; + memcpy (r->u.single_ASN1_type->buf, itemRequest_buf, itemRequest_size); + printf ("len = %d\n", itemRequest_size); + } + return r; +} +#else +static Z_External *create_external_itemRequest() +{ + return 0; +} +#endif static Z_External *CreateItemOrderExternal(int itemno) { Z_External *r = (Z_External *) odr_malloc(out, sizeof(Z_External)); @@ -1240,7 +1299,8 @@ static Z_External *CreateItemOrderExternal(int itemno) (int *) odr_malloc(out, sizeof(int)); *r->u.itemOrder->u.esRequest->notToKeep->resultSetItem->item = itemno; - r->u.itemOrder->u.esRequest->notToKeep->itemRequest = NULL; + r->u.itemOrder->u.esRequest->notToKeep->itemRequest = + create_external_itemRequest(); return r; }