X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=1da6fe96f39a4d58c607ac04ca87285dc4d6c1c3;hb=f78b96e6645bb3309719a234ff68699d8fccb975;hp=74d5a6ff5dfc21f2e09cba40ae7476eb4bbe3c74;hpb=29b509a56dc168a85a584454cc89ad61662536b0;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index 74d5a6f..1da6fe9 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2002, Index Data * See the file LICENSE for details. * - * $Id: client.c,v 1.154 2002-05-20 09:13:39 oleg Exp $ + * $Id: client.c,v 1.157 2002-06-04 11:36:10 adam Exp $ */ #include @@ -25,13 +25,9 @@ #include #include -#if YAZ_MODULE_ill #include -#endif -#if YAZ_MODULE_ccl #include -#endif #if HAVE_READLINE_READLINE_H #include @@ -88,9 +84,7 @@ typedef enum { static QueryType queryType = QueryType_Prefix; -#if YAZ_MODULE_ccl static CCL_bibset bibset; /* CCL bibset handle */ -#endif #if HAVE_READLINE_COMPLETION_OVER @@ -370,16 +364,24 @@ int cmd_open(char *arg) session_mem = NULL; } } - t = tcpip_type; - base[0] = '\0'; - if (sscanf (arg, "%100[^/]/%100s", type_and_host, base) < 1) - return 0; - - if(yazProxy) - conn = cs_create_host(yazProxy, 1, &add); - else - conn = cs_create_host(type_and_host, 1, &add); - + if (strncmp (arg, "unix:", 5) == 0) + { + base[0] = '\0'; + conn = cs_create_host(arg, 1, &add); + } + else + { + t = tcpip_type; + base[0] = '\0'; + if (sscanf (arg, "%100[^/]/%100s", type_and_host, base) < 1) + return 0; + + if(yazProxy) + conn = cs_create_host(yazProxy, 1, &add); + else + conn = cs_create_host(type_and_host, 1, &add); + + } if (!conn) { printf ("Couldn't create comstack\n"); @@ -442,6 +444,7 @@ int cmd_authentication(char *arg) } /* SEARCH SERVICE ------------------------------ */ +static void display_record(Z_External *r); static void display_variant(Z_Variant *v, int level) { @@ -463,7 +466,9 @@ static void display_grs1(Z_GenericRecord *r, int level) int i; if (!r) + { return; + } for (i = 0; i < r->num_elements; i++) { Z_TaggedElement *t; @@ -481,8 +486,13 @@ static void display_grs1(Z_GenericRecord *r, int level) printf("%s) ", t->tagValue->u.string); if (t->content->which == Z_ElementData_subtree) { - printf("\n"); - display_grs1(t->content->u.subtree, level+1); + if (!t->content->u.subtree) + printf (" (no subtree)\n"); + else + { + printf("\n"); + display_grs1(t->content->u.subtree, level+1); + } } else if (t->content->which == Z_ElementData_string) printf("%s\n", t->content->u.string); @@ -509,8 +519,15 @@ static void display_grs1(Z_GenericRecord *r, int level) printf("[Element empty]\n"); else if (t->content->which == Z_ElementData_elementNotThere) printf("[Element not there]\n"); + else if (t->content->which == Z_ElementData_date) + printf("Date: %s\n", t->content->u.date); + else if (t->content->which == Z_ElementData_ext) + { + printf ("External\n"); + display_record (t->content->u.ext); + } else - printf("??????\n"); + printf("? type = %d\n",t->content->which); if (t->appliedVariant) display_variant(t->appliedVariant, level+1); if (t->metaData && t->metaData->supportedVariants) @@ -587,6 +604,8 @@ static void display_record(Z_External *r) r->which = type->what; } } + if (ent && ent->oclass != CLASS_RECSYN) + return; if (ent && ent->value == VAL_SOIF) print_record((const unsigned char *) r->u.octet_aligned->buf, r->u.octet_aligned->len); @@ -773,15 +792,12 @@ static int send_searchRequest(char *arg) Z_SearchRequest *req = apdu->u.searchRequest; Z_Query query; int oid[OID_SIZE]; -#if YAZ_MODULE_ccl struct ccl_rpn_node *rpn = NULL; int error, pos; -#endif char setstring[100]; Z_RPNQuery *RPNquery; Odr_oct ccl_query; -#if YAZ_MODULE_ccl if (queryType == QueryType_CCL2RPN) { rpn = ccl_find_str(bibset, arg, &error, &pos); @@ -791,7 +807,6 @@ static int send_searchRequest(char *arg) return 0; } } -#endif req->referenceId = set_refid (out); if (!strcmp(arg, "@big")) /* strictly for troublemaking */ { @@ -849,7 +864,6 @@ static int send_searchRequest(char *arg) ccl_query.buf = (unsigned char*) arg; ccl_query.len = strlen(arg); break; -#if YAZ_MODULE_ccl case QueryType_CCL2RPN: query.which = Z_Query_type_1; RPNquery = ccl_rpn_query(out, rpn); @@ -861,7 +875,6 @@ static int send_searchRequest(char *arg) query.u.type_1 = RPNquery; ccl_rpn_delete (rpn); break; -#endif default: printf ("Unsupported query type\n"); return 0; @@ -1174,8 +1187,6 @@ void process_ESResponse(Z_ExtendedServicesResponse *res) } } -#if YAZ_MODULE_ill - const char *get_ill_element (void *clientData, const char *element) { return 0; @@ -1237,9 +1248,7 @@ static Z_External *create_external_itemRequest() } return r; } -#endif -#ifdef YAZ_MODULE_ill static Z_External *create_external_ILL_APDU(int which) { struct ill_get_ctl ctl; @@ -1295,7 +1304,6 @@ static Z_External *create_external_ILL_APDU(int which) } return r; } -#endif static Z_External *create_ItemOrderExternal(const char *type, int itemno)