X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=a7f9f5429dbda5baeed3ca5959f3795ce1322af2;hb=b9c0fc716a11606031639afe1e3ba6c420ba1035;hp=9b37bddc8107cff88d8241ae52dc6136ccceaaac;hpb=9a0db72d69faf9b014a9cb05c9c95c7d8ba214b9;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index 9b37bdd..a7f9f54 100644 --- a/client/client.c +++ b/client/client.c @@ -1,10 +1,21 @@ /* - * Copyright (c) 1995-2000, Index Data + * Copyright (c) 1995-2001, Index Data * See the file LICENSE for details. - * Sebastian Hammer, Adam Dickmeiss * * $Log: client.c,v $ - * Revision 1.111 2001-01-30 15:52:48 ja7 + * Revision 1.115 2001-03-13 18:10:58 adam + * Added option -c to set CCL config file. + * + * Revision 1.114 2001/02/21 13:46:53 adam + * C++ fixes. + * + * Revision 1.113 2001/02/21 09:41:15 adam + * Fixed problem with old codecs. + * + * Revision 1.112 2001/02/20 11:25:32 adam + * Added ill_get_APDU and ill_get_Cancel. + * + * Revision 1.111 2001/01/30 15:52:48 ja7 * added command for setting packageName in ES packages! * command is named packagename default is NULL for server suplyed package name * @@ -421,6 +432,7 @@ static NMEM session_mem = NULL; /* memory handle for init-response */ static Z_InitResponse *session = 0; /* session parameters */ static char last_scan_line[512] = "0"; static char last_scan_query[512] = "0"; +static char ccl_fields[512] = "default.bib"; char* esPackageName = 0; static char last_cmd[100] = "?"; @@ -1364,7 +1376,8 @@ static Z_External *create_external_itemRequest() 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, item_request_size); + r->u.single_ASN1_type->buf = (unsigned char *) + odr_malloc (out, item_request_size); r->u.single_ASN1_type->len = item_request_size; r->u.single_ASN1_type->size = item_request_size; memcpy (r->u.single_ASN1_type->buf, item_request_buf, @@ -1381,10 +1394,10 @@ static Z_External *create_external_itemRequest() #endif #ifdef ASN_COMPILED -static Z_External *create_external_ILLRequest() +static Z_External *create_external_ILL_APDU(int which) { struct ill_get_ctl ctl; - ILL_Request *req; + ILL_APDU *ill_apdu; Z_External *r = 0; int ill_request_size = 0; char *ill_request_buf = 0; @@ -1393,14 +1406,14 @@ static Z_External *create_external_ILLRequest() ctl.clientData = 0; ctl.f = get_ill_element; - req = ill_get_ILLRequest(&ctl, "ill", 0); + ill_apdu = ill_get_APDU(&ctl, "ill", 0); - if (!ill_Request (out, &req, 0, 0)) + if (!ill_APDU (out, &ill_apdu, 0, 0)) { if (apdu_file) { printf ("-------------------\n"); - ill_Request(print, &req, 0, 0); + ill_APDU(print, &ill_apdu, 0, 0); odr_reset(print); printf ("-------------------\n"); } @@ -1427,7 +1440,8 @@ static Z_External *create_external_ILLRequest() 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, ill_request_size); + r->u.single_ASN1_type->buf = (unsigned char *) + odr_malloc (out, ill_request_size); r->u.single_ASN1_type->len = ill_request_size; r->u.single_ASN1_type->size = ill_request_size; memcpy (r->u.single_ASN1_type->buf, ill_request_buf, ill_request_size); @@ -1490,6 +1504,7 @@ static Z_External *create_ItemOrderExternal(const char *type, int itemno) (int *) odr_malloc(out, sizeof(int)); *r->u.itemOrder->u.esRequest->notToKeep->resultSetItem->item = itemno; +#ifdef ASN_COMPILED if (!strcmp (type, "item") || !strcmp(type, "2")) { printf ("using item-request\n"); @@ -1500,16 +1515,20 @@ static Z_External *create_ItemOrderExternal(const char *type, int itemno) { printf ("using ILL-request\n"); r->u.itemOrder->u.esRequest->notToKeep->itemRequest = - create_external_ILLRequest(); + create_external_ILL_APDU(ILL_APDU_ILL_Request); } else r->u.itemOrder->u.esRequest->notToKeep->itemRequest = 0; + +#else + r->u.itemOrder->u.esRequest->notToKeep->itemRequest = 0; +#endif return r; } static int send_itemorder(const char *type, int itemno) { - Z_APDU *apdu = zget_APDU(out, Z_APDU_extendedServicesRequest ); + Z_APDU *apdu = zget_APDU(out, Z_APDU_extendedServicesRequest); Z_ExtendedServicesRequest *req = apdu->u.extendedServicesRequest; oident ItemOrderRequest; @@ -1901,7 +1920,7 @@ int send_scanrequest(const char *query, int pp, int num, const char *term) req->termListAndStartPoint->term->u.general) { req->termListAndStartPoint->term->u.general->buf = - odr_strdup(out, term); + (unsigned char *) odr_strdup(out, term); req->termListAndStartPoint->term->u.general->len = req->termListAndStartPoint->term->u.general->size = strlen(term); @@ -2359,7 +2378,7 @@ static void initialize(void) #if CCL2RPN bibset = ccl_qual_mk (); - inf = fopen ("default.bib", "r"); + inf = fopen (ccl_fields, "r"); if (inf) { ccl_qual_file (bibset, inf); @@ -2609,7 +2628,7 @@ int main(int argc, char **argv) int ret; int opened = 0; - while ((ret = options("a:m:v:", argv, argc, &arg)) != -2) + while ((ret = options("c:a:m:v:", argv, argc, &arg)) != -2) { switch (ret) { @@ -2628,6 +2647,10 @@ int main(int argc, char **argv) exit (1); } break; + case 'c': + strncpy (ccl_fields, arg, sizeof(ccl_fields)-1); + ccl_fields[sizeof(ccl_fields)-1] = '\0'; + break; case 'a': if (!strcmp(arg, "-")) apdu_file=stderr; @@ -2639,7 +2662,7 @@ int main(int argc, char **argv) break; default: fprintf (stderr, "Usage: %s [-m ] [ -a ] " - "[]\n", + "[-c cclfields] []\n", prog); exit (1); }