X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=client%2Fclient.c;h=9f24bd4c38ee4c3daa6ccd6a0bb3d1793aa4509c;hp=b92f15e76efba62216b62869b848d81d9d197344;hb=53c17d9dc2f7c8355bbac800ed02862eb5780d4f;hpb=29818ed78e32998641adcf5f23d3b854355918b5 diff --git a/client/client.c b/client/client.c index b92f15e..9f24bd4 100644 --- a/client/client.c +++ b/client/client.c @@ -4,7 +4,19 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: client.c,v $ - * Revision 1.24 1995-10-30 12:41:13 quinn + * 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 * Added hostname lookup for server. * * Revision 1.23 1995/10/18 16:12:30 quinn @@ -175,6 +187,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); @@ -298,7 +312,22 @@ int cmd_authentication(char *arg) /* SEARCH SERVICE ------------------------------ */ -void display_grs1(Z_GenericRecord *r, int level) +static void display_variant(Z_Variant *v, int level) +{ + int i; + + for (i = 0; i < v->num_triples; i++) + { + printf("%*sclass=%d,type=%d", level * 4, "", *v->triples[i]->class, + *v->triples[i]->type); + if (v->triples[i]->which == Z_Triple_internationalString) + printf(",value=%s\n", v->triples[i]->value.internationalString); + else + printf("\n"); + } +} + +static void display_grs1(Z_GenericRecord *r, int level) { int i; @@ -328,12 +357,31 @@ void display_grs1(Z_GenericRecord *r, int level) printf("%s\n", t->content->u.string); else if (t->content->which == Z_ElementData_numeric) printf("%d\n", *t->content->u.numeric); + else if (t->content->which == Z_ElementData_noDataRequested) + printf("[No data requested]\n"); + else if (t->content->which == Z_ElementData_elementEmpty) + printf("[Element empty]\n"); + else if (t->content->which == Z_ElementData_elementNotThere) + printf("[Element not there]\n"); else printf("??????\n"); + if (t->appliedVariant) + display_variant(t->appliedVariant, level+1); + if (t->metaData && t->metaData->supportedVariants) + { + int c; + + printf("%*s---- variant list\n", (level+1)*4, ""); + for (c = 0; c < t->metaData->num_supportedVariants; c++) + { + printf("%*svariant #%d\n", (level+1)*4, "", c); + display_variant(t->metaData->supportedVariants[c], level + 2); + } + } } } -void display_record(Z_DatabaseRecord *p) +static void display_record(Z_DatabaseRecord *p) { Z_External *r = (Z_External*) p; oident *ent = oid_getentbyoid(r->direct_reference); @@ -846,6 +894,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"); @@ -1051,7 +1105,7 @@ static int client(void) apdu->which); exit(1); } - printf("Z> "); + printf(C_PROMPT); fflush(stdout); } while (cs_more(conn));