X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=d58c0828dcfa1e49c21633ddc28ff3a925b46d45;hb=454369fd9e16211e97c8decd7be3c4e9729df6bf;hp=f0cab9b7b5d2f1313f48fd286bf80d9f5ee18a7c;hpb=8fa3d0c0967fd6db5c7a2b2ffc504cb48407a586;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index f0cab9b..d58c082 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: client.c,v 1.246 2004-08-11 11:44:30 adam Exp $ + * $Id: client.c,v 1.249 2004-09-13 09:24:42 adam Exp $ */ #include @@ -379,9 +379,25 @@ static int process_initResponse(Z_InitResponse *res) printf("Guessing visiblestring:\n"); printf("'%s'\n", uif->u. octet_aligned->buf); } else if (uif->which == Z_External_single) { - /* Peek at any private Init-diagnostic APDUs */ Odr_any *sat = uif->u.single_ASN1_type; - printf("### NAUGHTY: External is '%s'\n", sat->buf); + oident *oid = oid_getentbyoid(uif->direct_reference); + if (oid->value == VAL_OCLCUI) { + Z_OCLC_UserInformation *oclc_ui; + ODR decode = odr_createmem(ODR_DECODE); + odr_setbuf(decode, sat->buf, sat->len, 0); + if (!z_OCLC_UserInformation(decode, &oclc_ui, 0, 0)) + printf ("Bad OCLC UserInformation:\n"); + else + printf ("OCLC UserInformation:\n"); + if (!z_OCLC_UserInformation(print, &oclc_ui, 0, 0)) + printf ("Bad OCLC UserInformation spec\n"); + odr_destroy(decode); + } + else + { + /* Peek at any private Init-diagnostic APDUs */ + printf("### NAUGHTY: External is '%.*s'\n", sat->len, sat->buf); + } } odr_reset (print); } @@ -568,6 +584,8 @@ int session_connect(const char *arg) return 0; } #if HAVE_XML2 + if (conn->protocol == PROTO_HTTP) + queryType = QueryType_CQL; #else if (conn->protocol == PROTO_HTTP) { @@ -1244,13 +1262,28 @@ static int send_SRW_searchRequest(const char *arg) /* save this for later .. when fetching individual records */ srw_sr = sr = yaz_srw_get(srw_sr_odr_out, Z_SRW_searchRetrieve_request); - sr->u.request->query_type = Z_SRW_query_type_cql; - sr->u.request->query.cql = odr_strdup(srw_sr_odr_out, arg); - + + /* regular request .. */ sr = yaz_srw_get(out, Z_SRW_searchRetrieve_request); - sr->u.request->query_type = Z_SRW_query_type_cql; - sr->u.request->query.cql = odr_strdup(out, arg); + switch(queryType) + { + case QueryType_CQL: + sr->u.request->query_type = Z_SRW_query_type_cql; + sr->u.request->query.cql = odr_strdup(srw_sr_odr_out, arg); + sr->u.request->query_type = Z_SRW_query_type_cql; + sr->u.request->query.cql = odr_strdup(out, arg); + break; + case QueryType_Prefix: + sr->u.request->query_type = Z_SRW_query_type_pqf; + sr->u.request->query.pqf = odr_strdup(srw_sr_odr_out, arg); + sr->u.request->query_type = Z_SRW_query_type_pqf; + sr->u.request->query.pqf = odr_strdup(out, arg); + break; + default: + printf ("Only CQL and PQF supported in SRW\n"); + return 0; + } sr->u.request->maximumRecords = odr_intdup(out, 0); if (record_schema) @@ -3212,7 +3245,7 @@ int cmd_register_oid(const char* args) { name = oid_str; val = 0; - while (isdigit (*name)) + while (isdigit (*(unsigned char *) name)) { val = val*10 + (*name - '0'); name++; @@ -3972,11 +4005,11 @@ void process_cmd_line(char* line) /* removed tailing spaces from the arg command */ { - unsigned char* p = arg; + char* p = arg; char* lastnonspace=NULL; for(;*p; ++p) { - if(!isspace(*p)) { + if(!isspace(*(unsigned char *) p)) { lastnonspace = p; } }