X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=f1537008ccd9d40b98077f3333133bd07d053d7d;hb=1aef484f50fc535620d43dab81584432115681b2;hp=4ecfff2cfde6079272db946d25330324dca35bee;hpb=a309d6ece06c0ab732d98c59f2718efaebd01ec6;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index 4ecfff2..f153700 100644 --- a/client/client.c +++ b/client/client.c @@ -4,7 +4,19 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: client.c,v $ - * Revision 1.25 1995-11-13 09:27:22 quinn + * Revision 1.29 1996-01-02 08:57:25 quinn + * Changed enums in the ASN.1 .h files to #defines. Changed oident.class to oclass + * + * Revision 1.28 1995/12/14 11:09:31 quinn + * Added Explain record syntax to the format command. + * + * Revision 1.27 1995/12/12 16:37:02 quinn + * Added destroy element to data1_node. + * + * Revision 1.26 1995/12/12 14:11:00 quinn + * Minimal. + * + * Revision 1.25 1995/11/13 09:27:22 quinn * Fiddling with the variant stuff. * * Revision 1.24 1995/10/30 12:41:13 quinn @@ -136,6 +148,8 @@ static ODR_MEM session_mem; /* memory handle for init-response */ static Z_InitResponse *session = 0; /* session parameters */ static char last_scan[512] = "0"; static char last_cmd[100] = "?"; +static oid_value attributeset = VAL_BIB1; + #ifdef RPN_QUERY #ifndef PREFIX_QUERY static CCL_bibset bibset; /* CCL bibset handle */ @@ -178,6 +192,8 @@ static void send_initRequest() ODR_MASK_SET(req->protocolVersion, Z_ProtocolVersion_2); ODR_MASK_SET(req->protocolVersion, Z_ProtocolVersion_3); + *req->maximumRecordSize = 1024*1024; + req->idAuthentication = auth; send_apdu(apdu); @@ -437,7 +453,7 @@ static void display_diagrec(Z_DiagRec *p) r = p->u.defaultFormat; #endif if (!(ent = oid_getentbyoid(r->diagnosticSetId)) || - ent->class != CLASS_DIAGSET || ent->value != VAL_BIB1) + ent->oclass != CLASS_DIAGSET || ent->value != VAL_BIB1) printf("Missing or unknown diagset\n"); printf(" [%d] %s", *r->condition, diagbib1_str(*r->condition)); if (r->addinfo && *r->addinfo) @@ -527,7 +543,7 @@ static int send_searchRequest(char *arg) oident prefsyn; prefsyn.proto = protocol; - prefsyn.class = CLASS_RECSYN; + prefsyn.oclass = CLASS_RECSYN; prefsyn.value = recordsyntax; req->preferredRecordSyntax = odr_oiddup(out, oid_getoidbyent(&prefsyn)); req->smallSetElementSetNames = @@ -552,7 +568,7 @@ static int send_searchRequest(char *arg) } #endif bib1.proto = protocol; - bib1.class = CLASS_ATTSET; + bib1.oclass = CLASS_ATTSET; bib1.value = VAL_BIB1; RPNquery->attributeSetId = oid_getoidbyent(&bib1); query.u.type_1 = RPNquery; @@ -685,7 +701,7 @@ static int send_presentRequest(char *arg) req->resultSetStartPoint = &setno; req->numberOfRecordsRequested = &nos; prefsyn.proto = protocol; - prefsyn.class = CLASS_RECSYN; + prefsyn.oclass = CLASS_RECSYN; prefsyn.value = recordsyntax; req->preferredRecordSyntax = oid_getoidbyent(&prefsyn); if (elementSetNames) @@ -779,7 +795,7 @@ int send_scanrequest(char *string, int pp, int num) req->num_databaseNames = 1; req->databaseNames = &db; attset.proto = protocol; - attset.class = CLASS_ATTSET; + attset.oclass = CLASS_ATTSET; attset.value = VAL_BIB1; req->attributeSet = oid_getoidbyent(&attset); req->termListAndStartPoint = p_query_scan(out, string); @@ -883,6 +899,12 @@ int cmd_format(char *arg) recordsyntax = VAL_GRS1; return 1; } + else if (!strcmp(arg, "explain")) + { + printf("Preferred format is Explain\n"); + recordsyntax = VAL_EXPLAIN; + return 1; + } else { printf("Specify one of {sutrs,usmarc,danmarc,grs1}.\n"); @@ -907,6 +929,26 @@ int cmd_elements(char *arg) return 1; } +int cmd_attributeset(char *arg) +{ + char what[100]; + oid_value v; + + if (!arg || !*arg) + { + printf("Usage: attributeset \n"); + return 0; + } + sscanf(arg, "%s", what); + if ((v = oid_getvalbyname(what)) == VAL_NONE) + { + printf("Unknown attribute set name\n"); + return 0; + } + attributeset = v; + return 1; +} + int cmd_close(char *arg) { Z_APDU *apdu = zget_APDU(out, Z_APDU_close); @@ -972,6 +1014,7 @@ static int client(void) {"format", cmd_format, ""}, {"elements", cmd_elements, ""}, {"close", cmd_close, ""}, + {"attributeset", cmd_attributeset, ""}, {0,0} }; char *netbuffer= 0; @@ -1088,7 +1131,7 @@ static int client(void) apdu->which); exit(1); } - printf("Z> "); + printf(C_PROMPT); fflush(stdout); } while (cs_more(conn));