X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=client%2Fclient.c;h=7fe8df2a6e77e2b29f745786a64358e33de5b638;hp=9a43b9507461854fd5de36046c7f9e179c0f25ce;hb=7057699040b614f56be178f3672b4a2b95301d5f;hpb=fb36df3c32d9023ca55f8050ea4128f42d2dfc34 diff --git a/client/client.c b/client/client.c index 9a43b95..7fe8df2 100644 --- a/client/client.c +++ b/client/client.c @@ -3,7 +3,13 @@ * See the file LICENSE for details. * * $Log: client.c,v $ - * Revision 1.118 2001-03-27 14:48:06 adam + * Revision 1.120 2001-04-06 12:26:46 adam + * Optional CCL module. Moved atoi_n to marcdisp.h from yaz-util.h. + * + * Revision 1.119 2001/04/05 13:08:48 adam + * New configure options: --enable-module. + * + * Revision 1.118 2001/03/27 14:48:06 adam * Fixed scan for bad CCL. * * Revision 1.117 2001/03/25 21:55:12 adam @@ -401,11 +407,11 @@ #include -#ifdef ASN_COMPILED +#if YAZ_MODULE_ill #include #endif -#if CCL2RPN +#if YAZ_MODULE_ccl #include #endif @@ -442,7 +448,7 @@ 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* esPackageName = 0; static char last_cmd[100] = "?"; static FILE *marcdump = 0; @@ -456,7 +462,7 @@ typedef enum { static QueryType queryType = QueryType_Prefix; -#if CCL2RPN +#if YAZ_MODULE_ccl static CCL_bibset bibset; /* CCL bibset handle */ #endif @@ -1019,7 +1025,7 @@ static int send_searchRequest(char *arg) Z_SearchRequest *req = apdu->u.searchRequest; Z_Query query; int oid[OID_SIZE]; -#if CCL2RPN +#if YAZ_MODULE_ccl struct ccl_rpn_node *rpn = NULL; int error, pos; #endif @@ -1027,7 +1033,7 @@ static int send_searchRequest(char *arg) Z_RPNQuery *RPNquery; Odr_oct ccl_query; -#if CCL2RPN +#if YAZ_MODULE_ccl if (queryType == QueryType_CCL2RPN) { rpn = ccl_find_str(bibset, arg, &error, &pos); @@ -1095,7 +1101,7 @@ static int send_searchRequest(char *arg) ccl_query.buf = (unsigned char*) arg; ccl_query.len = strlen(arg); break; -#if CCL2RPN +#if YAZ_MODULE_ccl case QueryType_CCL2RPN: query.which = Z_Query_type_1; RPNquery = ccl_rpn_query(out, rpn); @@ -1314,7 +1320,7 @@ void process_ESResponse(Z_ExtendedServicesResponse *res) } } -#ifdef ASN_COMPILED +#if YAZ_MODULE_ill const char *get_ill_element (void *clientData, const char *element) { @@ -1378,14 +1384,9 @@ static Z_External *create_external_itemRequest() } return r; } -#else -static Z_External *create_external_itemRequest() -{ - return 0; -} #endif -#ifdef ASN_COMPILED +#ifdef YAZ_MODULE_ill static Z_External *create_external_ILL_APDU(int which) { struct ill_get_ctl ctl; @@ -1441,11 +1442,6 @@ static Z_External *create_external_ILL_APDU(int which) } return r; } -#else -static Z_External *create_external_ILLRequest() -{ - return 0; -} #endif @@ -1496,7 +1492,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 YAZ_MODULE_ill if (!strcmp (type, "item") || !strcmp(type, "2")) { printf ("using item-request\n"); @@ -1509,6 +1505,17 @@ static Z_External *create_ItemOrderExternal(const char *type, int itemno) r->u.itemOrder->u.esRequest->notToKeep->itemRequest = create_external_ILL_APDU(ILL_APDU_ILL_Request); } + else if (!strcmp(type, "xml") || !strcmp(type, "3")) + { + const char *xml_buf = + "\n" + " request\n" + " 000200\n" + " 1212 \n" + ""; + r->u.itemOrder->u.esRequest->notToKeep->itemRequest = + z_ext_record (out, VAL_TEXT_XML, xml_buf, strlen(xml_buf)); + } else r->u.itemOrder->u.esRequest->notToKeep->itemRequest = 0; @@ -1871,9 +1878,9 @@ int send_scanrequest(const char *query, int pp, int num, const char *term) Z_APDU *apdu = zget_APDU(out, Z_APDU_scanRequest); Z_ScanRequest *req = apdu->u.scanRequest; int use_rpn = 1; +#if YAZ_MODULE_ccl int oid[OID_SIZE]; -#if CCL2RPN if (queryType == QueryType_CCL2RPN) { oident bib1; @@ -2295,7 +2302,7 @@ int cmd_querytype (char *arg) queryType = QueryType_CCL; else if (!strcmp (arg, "prefix") || !strcmp(arg, "rpn")) queryType = QueryType_Prefix; -#if CCL2RPN +#if YAZ_MODULE_ccl else if (!strcmp (arg, "ccl2rpn") || !strcmp (arg, "cclrpn")) queryType = QueryType_CCL2RPN; #endif @@ -2304,7 +2311,7 @@ int cmd_querytype (char *arg) printf ("Querytype must be one of:\n"); printf (" prefix - Prefix query\n"); printf (" ccl - CCL query\n"); -#if CCL2RPN +#if YAZ_MODULE_ccl printf (" ccl2rpn - CCL query converted to RPN\n"); #endif return 0; @@ -2353,7 +2360,7 @@ int cmd_packagename(char* arg) { static void initialize(void) { -#if CCL2RPN +#if YAZ_MODULE_ccl FILE *inf; #endif nmem_init(); @@ -2368,7 +2375,7 @@ static void initialize(void) if (apdu_file) odr_setprint(print, apdu_file); -#if CCL2RPN +#if YAZ_MODULE_ccl bibset = ccl_qual_mk (); inf = fopen (ccl_fields, "r"); if (inf)