X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=a57f354d99afdfe7ace32dbb77cde893de03a0db;hb=fed4c59a3c26f04ba3764947aa2f7ecdd9b46889;hp=c7c6e1b07c14887abed1fea78acc0ec8fb42472d;hpb=985066ac6dfae6ac68960044fa05b4f7ea782b86;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index c7c6e1b..a57f354 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2003, Index Data * See the file LICENSE for details. * - * $Id: client.c,v 1.201 2003-06-19 21:10:03 adam Exp $ + * $Id: client.c,v 1.205 2003-07-23 12:57:22 mike Exp $ */ #include @@ -332,18 +332,22 @@ static int process_initResponse(Z_InitResponse *res) printf("Version: %s\n", res->implementationVersion); if (res->userInformationField) { + Z_External *uif = res->userInformationField; printf("UserInformationfield:\n"); - if (!z_External(print, (Z_External**)&res-> userInformationField, - 0, 0)) + if (!z_External(print, (Z_External**)&uif, 0, 0)) { odr_perror(print, "Printing userinfo\n"); odr_reset(print); } - if (res->userInformationField->which == Z_External_octet) + if (uif->which == Z_External_octet) { printf("Guessing visiblestring:\n"); - printf("'%s'\n", res->userInformationField->u. octet_aligned->buf); - } + 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); + } odr_reset (print); } printf ("Options:"); @@ -580,14 +584,20 @@ int cmd_authentication(const char *arg) r = sscanf (arg, "%39s %39s %39s", user, group, pass); if (r == 0) { - printf("Auth field set to null\n"); + printf("Authentication set to null\n"); auth = 0; } if (r == 1) { auth = &au; - au.which = Z_IdAuthentication_open; - au.u.open = user; + if (!strcmp(user, "-")) { + au.which = Z_IdAuthentication_anonymous; + printf("Authentication set to Anonymous\n"); + } else { + au.which = Z_IdAuthentication_open; + au.u.open = user; + printf("Authentication set to Open (%s)\n", user); + } } if (r == 2) { @@ -597,6 +607,7 @@ int cmd_authentication(const char *arg) idPass.groupId = NULL; idPass.userId = user; idPass.password = group; + printf("Authentication set to User (%s), Pass (%s)\n", user, group); } if (r == 3) { @@ -606,6 +617,8 @@ int cmd_authentication(const char *arg) idPass.groupId = group; idPass.userId = user; idPass.password = pass; + printf("Authentication set to User (%s), Group (%s), Pass (%s)\n", + user, group, pass); } return 1; } @@ -808,6 +821,107 @@ static void display_record(Z_External *r) puts (wrbuf_buf(w)); wrbuf_free(w, 1); } + else if ( /* OPAC display not complete yet .. */ + ent && ent->value == VAL_OPAC) + { + int i; + if (r->u.opac->bibliographicRecord) + display_record(r->u.opac->bibliographicRecord); + for (i = 0; iu.opac->num_holdingsData; i++) + { + Z_HoldingsRecord *h = r->u.opac->holdingsData[i]; + if (h->which == Z_HoldingsRecord_marcHoldingsRecord) + { + printf ("MARC holdings %d\n", i); + display_record(h->u.marcHoldingsRecord); + } + else if (h->which == Z_HoldingsRecord_holdingsAndCirc) + { + int j; + + Z_HoldingsAndCircData *data = h->u.holdingsAndCirc; + + printf ("Data holdings %d\n", i); + if (data->typeOfRecord) + printf ("typeOfRecord: %s\n", data->typeOfRecord); + if (data->encodingLevel) + printf ("encodingLevel: %s\n", data->encodingLevel); + if (data->receiptAcqStatus) + printf ("receiptAcqStatus: %s\n", data->receiptAcqStatus); + if (data->generalRetention) + printf ("generalRetention: %s\n", data->generalRetention); + if (data->completeness) + printf ("completeness: %s\n", data->completeness); + if (data->dateOfReport) + printf ("dateOfReport: %s\n", data->dateOfReport); + if (data->nucCode) + printf ("nucCode: %s\n", data->nucCode); + if (data->localLocation) + printf ("localLocation: %s\n", data->localLocation); + if (data->shelvingLocation) + printf ("shelvingLocation: %s\n", data->shelvingLocation); + if (data->callNumber) + printf ("callNumber: %s\n", data->callNumber); + if (data->copyNumber) + printf ("copyNumber: %s\n", data->copyNumber); + if (data->publicNote) + printf ("publicNote: %s\n", data->publicNote); + if (data->reproductionNote) + printf ("reproductionNote: %s\n", data->reproductionNote); + if (data->termsUseRepro) + printf ("termsUseRepro: %s\n", data->termsUseRepro); + if (data->enumAndChron) + printf ("enumAndChron: %s\n", data->enumAndChron); + for (j = 0; jnum_volumes; j++) + { + printf ("volume %d\n", j); + if (data->volumes[j]->enumeration) + printf (" enumeration: %s\n", + data->volumes[j]->enumeration); + if (data->volumes[j]->chronology) + printf (" chronology: %s\n", + data->volumes[j]->chronology); + if (data->volumes[j]->enumAndChron) + printf (" enumAndChron: %s\n", + data->volumes[j]->enumAndChron); + } + for (j = 0; jnum_circulationData; j++) + { + printf ("circulation %d\n", j); + if (data->circulationData[j]->availableNow) + printf (" availableNow: %d\n", + *data->circulationData[j]->availableNow); + if (data->circulationData[j]->availablityDate) + printf (" availabiltyDate: %s\n", + data->circulationData[j]->availablityDate); + if (data->circulationData[j]->availableThru) + printf (" availableThru: %s\n", + data->circulationData[j]->availableThru); + if (data->circulationData[j]->restrictions) + printf (" restrictions: %s\n", + data->circulationData[j]->restrictions); + if (data->circulationData[j]->itemId) + printf (" itemId: %s\n", + data->circulationData[j]->itemId); + if (data->circulationData[j]->renewable) + printf (" renewable: %d\n", + *data->circulationData[j]->renewable); + if (data->circulationData[j]->onHold) + printf (" onHold: %d\n", + *data->circulationData[j]->onHold); + if (data->circulationData[j]->enumAndChron) + printf (" enumAndChron: %s\n", + data->circulationData[j]->enumAndChron); + if (data->circulationData[j]->midspine) + printf (" midspine: %s\n", + data->circulationData[j]->midspine); + if (data->circulationData[j]->temporaryLocation) + printf (" temporaryLocation: %s\n", + data->circulationData[j]->temporaryLocation); + } + } + } + } else { printf("Unknown record representation.\n");