- Z_External *uif = res->userInformationField;
- if (uif->which == Z_External_userInfo1) {
- render_initUserInfo(uif->u.userInfo1);
- } else {
- printf("UserInformationfield:\n");
- if (!z_External(print, (Z_External**)&uif, 0, 0))
- {
- odr_perror(print, "Printing userinfo\n");
- odr_reset(print);
- }
- if (uif->which == Z_External_octet) {
- printf("Guessing visiblestring:\n");
- printf("'%.*s'\n", uif->u.octet_aligned->len,
- uif->u.octet_aligned->buf);
- }
- else if (uif->which == Z_External_single)
- {
- Odr_any *sat = uif->u.single_ASN1_type;
- 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);
- }
+ Z_External *uif = res->userInformationField;
+ if (uif->which == Z_External_userInfo1) {
+ render_initUserInfo(uif->u.userInfo1);
+ } else {
+ printf("UserInformationfield:\n");
+ if (!z_External(print, (Z_External**)&uif, 0, 0))
+ {
+ odr_perror(print, "Printing userinfo\n");
+ odr_reset(print);
+ }
+ if (uif->which == Z_External_octet) {
+ printf("Guessing visiblestring:\n");
+ printf("'%.*s'\n", uif->u.octet_aligned->len,
+ uif->u.octet_aligned->buf);
+ }
+ else if (uif->which == Z_External_single)
+ {
+ Odr_any *sat = uif->u.single_ASN1_type;
+ 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, (char *) 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);
+ }
- int i;
- if (r->u.opac->bibliographicRecord)
- display_record(r->u.opac->bibliographicRecord);
- for (i = 0; i<r->u.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->shelvingData)
- printf ("shelvingData: %s\n", data->shelvingData);
- 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; j<data->num_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; j<data->num_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);
- }
- }
- }
+ int i;
+ if (r->u.opac->bibliographicRecord)
+ display_record(r->u.opac->bibliographicRecord);
+ for (i = 0; i<r->u.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->shelvingData)
+ printf ("shelvingData: %s\n", data->shelvingData);
+ 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; j<data->num_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; j<data->num_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);
+ }
+ }
+ }
- Z_IU0OriginPartToKeep *toKeep;
- Z_IU0SuppliedRecords *notToKeep;
-
- r->which = Z_External_update0;
- r->u.update0 = (Z_IU0Update *) odr_malloc(out, sizeof(*r->u.update0));
- r->u.update0->which = Z_IUUpdate_esRequest;
- r->u.update0->u.esRequest = (Z_IU0UpdateEsRequest *)
- odr_malloc(out, sizeof(*r->u.update0->u.esRequest));
- toKeep = r->u.update0->u.esRequest->toKeep = (Z_IU0OriginPartToKeep *)
- odr_malloc(out, sizeof(*r->u.update0->u.esRequest->toKeep));
-
- toKeep->databaseName = databaseNames[0];
- toKeep->schema = 0;
- toKeep->elementSetName = 0;
-
- toKeep->action = (int *) odr_malloc(out, sizeof(*toKeep->action));
- *toKeep->action = action_no;
-
- notToKeep = r->u.update0->u.esRequest->notToKeep = (Z_IU0SuppliedRecords *)
- odr_malloc(out, sizeof(*r->u.update0->u.esRequest->notToKeep));
- notToKeep->num = 1;
- notToKeep->elements = (Z_IU0SuppliedRecords_elem **)
- odr_malloc(out, sizeof(*notToKeep->elements));
- notToKeep->elements[0] = (Z_IU0SuppliedRecords_elem *)
- odr_malloc(out, sizeof(**notToKeep->elements));
- notToKeep->elements[0]->which = Z_IUSuppliedRecords_elem_opaque;
- if (*recid)
- {
- notToKeep->elements[0]->u.opaque = (Odr_oct *)
- odr_malloc (out, sizeof(Odr_oct));
- notToKeep->elements[0]->u.opaque->buf = (unsigned char *) recid;
- notToKeep->elements[0]->u.opaque->size = strlen(recid);
- notToKeep->elements[0]->u.opaque->len = strlen(recid);
- }
- else
- notToKeep->elements[0]->u.opaque = 0;
- notToKeep->elements[0]->supplementalId = 0;
- notToKeep->elements[0]->correlationInfo = 0;
- notToKeep->elements[0]->record = record_this;
+ Z_IU0OriginPartToKeep *toKeep;
+ Z_IU0SuppliedRecords *notToKeep;
+
+ r->which = Z_External_update0;
+ r->u.update0 = (Z_IU0Update *) odr_malloc(out, sizeof(*r->u.update0));
+ r->u.update0->which = Z_IUUpdate_esRequest;
+ r->u.update0->u.esRequest = (Z_IU0UpdateEsRequest *)
+ odr_malloc(out, sizeof(*r->u.update0->u.esRequest));
+ toKeep = r->u.update0->u.esRequest->toKeep = (Z_IU0OriginPartToKeep *)
+ odr_malloc(out, sizeof(*r->u.update0->u.esRequest->toKeep));
+
+ toKeep->databaseName = databaseNames[0];
+ toKeep->schema = 0;
+ toKeep->elementSetName = 0;
+
+ toKeep->action = (int *) odr_malloc(out, sizeof(*toKeep->action));
+ *toKeep->action = action_no;
+
+ notToKeep = r->u.update0->u.esRequest->notToKeep = (Z_IU0SuppliedRecords *)
+ odr_malloc(out, sizeof(*r->u.update0->u.esRequest->notToKeep));
+ notToKeep->num = 1;
+ notToKeep->elements = (Z_IU0SuppliedRecords_elem **)
+ odr_malloc(out, sizeof(*notToKeep->elements));
+ notToKeep->elements[0] = (Z_IU0SuppliedRecords_elem *)
+ odr_malloc(out, sizeof(**notToKeep->elements));
+ notToKeep->elements[0]->which = Z_IUSuppliedRecords_elem_opaque;
+ if (*recid && strcmp(recid, "none"))
+ {
+ notToKeep->elements[0]->u.opaque = (Odr_oct *)
+ odr_malloc (out, sizeof(Odr_oct));
+ notToKeep->elements[0]->u.opaque->buf = (unsigned char *) recid;
+ notToKeep->elements[0]->u.opaque->size = strlen(recid);
+ notToKeep->elements[0]->u.opaque->len = strlen(recid);
+ }
+ else
+ notToKeep->elements[0]->u.opaque = 0;
+ notToKeep->elements[0]->supplementalId = 0;
+ notToKeep->elements[0]->correlationInfo = 0;
+ notToKeep->elements[0]->record = record_this;
- Z_IUOriginPartToKeep *toKeep;
- Z_IUSuppliedRecords *notToKeep;
-
- r->which = Z_External_update;
- r->u.update = (Z_IUUpdate *) odr_malloc(out, sizeof(*r->u.update));
- r->u.update->which = Z_IUUpdate_esRequest;
- r->u.update->u.esRequest = (Z_IUUpdateEsRequest *)
- odr_malloc(out, sizeof(*r->u.update->u.esRequest));
- toKeep = r->u.update->u.esRequest->toKeep = (Z_IUOriginPartToKeep *)
- odr_malloc(out, sizeof(*r->u.update->u.esRequest->toKeep));
-
- toKeep->databaseName = databaseNames[0];
- toKeep->schema = 0;
- toKeep->elementSetName = 0;
- toKeep->actionQualifier = 0;
- toKeep->action = (int *) odr_malloc(out, sizeof(*toKeep->action));
- *toKeep->action = action_no;
-
- notToKeep = r->u.update->u.esRequest->notToKeep = (Z_IUSuppliedRecords *)
- odr_malloc(out, sizeof(*r->u.update->u.esRequest->notToKeep));
- notToKeep->num = 1;
- notToKeep->elements = (Z_IUSuppliedRecords_elem **)
- odr_malloc(out, sizeof(*notToKeep->elements));
- notToKeep->elements[0] = (Z_IUSuppliedRecords_elem *)
- odr_malloc(out, sizeof(**notToKeep->elements));
- notToKeep->elements[0]->which = Z_IUSuppliedRecords_elem_opaque;
- if (*recid)
- {
- notToKeep->elements[0]->u.opaque = (Odr_oct *)
- odr_malloc (out, sizeof(Odr_oct));
- notToKeep->elements[0]->u.opaque->buf = (unsigned char *) recid;
- notToKeep->elements[0]->u.opaque->size = strlen(recid);
- notToKeep->elements[0]->u.opaque->len = strlen(recid);
- }
- else
- notToKeep->elements[0]->u.opaque = 0;
- notToKeep->elements[0]->supplementalId = 0;
- notToKeep->elements[0]->correlationInfo = 0;
- notToKeep->elements[0]->record = record_this;
+ Z_IUOriginPartToKeep *toKeep;
+ Z_IUSuppliedRecords *notToKeep;
+
+ r->which = Z_External_update;
+ r->u.update = (Z_IUUpdate *) odr_malloc(out, sizeof(*r->u.update));
+ r->u.update->which = Z_IUUpdate_esRequest;
+ r->u.update->u.esRequest = (Z_IUUpdateEsRequest *)
+ odr_malloc(out, sizeof(*r->u.update->u.esRequest));
+ toKeep = r->u.update->u.esRequest->toKeep = (Z_IUOriginPartToKeep *)
+ odr_malloc(out, sizeof(*r->u.update->u.esRequest->toKeep));
+
+ toKeep->databaseName = databaseNames[0];
+ toKeep->schema = 0;
+ toKeep->elementSetName = 0;
+ toKeep->actionQualifier = 0;
+ toKeep->action = (int *) odr_malloc(out, sizeof(*toKeep->action));
+ *toKeep->action = action_no;
+
+ notToKeep = r->u.update->u.esRequest->notToKeep = (Z_IUSuppliedRecords *)
+ odr_malloc(out, sizeof(*r->u.update->u.esRequest->notToKeep));
+ notToKeep->num = 1;
+ notToKeep->elements = (Z_IUSuppliedRecords_elem **)
+ odr_malloc(out, sizeof(*notToKeep->elements));
+ notToKeep->elements[0] = (Z_IUSuppliedRecords_elem *)
+ odr_malloc(out, sizeof(**notToKeep->elements));
+ notToKeep->elements[0]->which = Z_IUSuppliedRecords_elem_opaque;
+ if (*recid)
+ {
+ notToKeep->elements[0]->u.opaque = (Odr_oct *)
+ odr_malloc (out, sizeof(Odr_oct));
+ notToKeep->elements[0]->u.opaque->buf = (unsigned char *) recid;
+ notToKeep->elements[0]->u.opaque->size = strlen(recid);
+ notToKeep->elements[0]->u.opaque->len = strlen(recid);
+ }
+ else
+ notToKeep->elements[0]->u.opaque = 0;
+ notToKeep->elements[0]->supplementalId = 0;
+ notToKeep->elements[0]->correlationInfo = 0;
+ notToKeep->elements[0]->record = record_this;
- printf("Proximity:\n");
- printf(" @prox exl dist ord rel uc ut\n");
- printf(" exl: exclude flag . 0=include, 1=exclude.\n");
- printf(" dist: distance integer.\n");
- printf(" ord: order flag. 0=unordered, 1=ordered.\n");
- printf(" rel: relation integer. 1< 2<= 3= 4>= 5> 6!= .\n");
- printf(" uc: unit class. k=known, p=private.\n");
- printf(" ut: unit type. 1=character, 2=word, 3=sentence,\n");
- printf(" 4=paragraph, 5=section, 6=chapter, 7=document,\n");
- printf(" 8=element, 9=subelement, 10=elementType, 11=byte.\n");
- printf("\nExamples:\n");
- printf(" Search for a and b in-order at most 3 words apart:\n");
- printf(" @prox 0 3 1 2 k 2 a b\n");
- printf(" Search for any order of a and b next to each other:\n");
- printf(" @prox 0 1 0 3 k 2 a b\n");
+ printf("Proximity:\n");
+ printf(" @prox exl dist ord rel uc ut\n");
+ printf(" exl: exclude flag . 0=include, 1=exclude.\n");
+ printf(" dist: distance integer.\n");
+ printf(" ord: order flag. 0=unordered, 1=ordered.\n");
+ printf(" rel: relation integer. 1< 2<= 3= 4>= 5> 6!= .\n");
+ printf(" uc: unit class. k=known, p=private.\n");
+ printf(" ut: unit type. 1=character, 2=word, 3=sentence,\n");
+ printf(" 4=paragraph, 5=section, 6=chapter, 7=document,\n");
+ printf(" 8=element, 9=subelement, 10=elementType, 11=byte.\n");
+ printf("\nExamples:\n");
+ printf(" Search for a and b in-order at most 3 words apart:\n");
+ printf(" @prox 0 3 1 2 k 2 a b\n");
+ printf(" Search for any order of a and b next to each other:\n");
+ printf(" @prox 0 1 0 3 k 2 a b\n");