+ IRSetObj *setobj = p->child;
+ Z_Records *zrs = presrs->records;
+ setobj->z_records = presrs->records;
+
+ printf ("Received presentResponse\n");
+ if (zrs)
+ {
+ if (zrs->which == Z_Records_NSD)
+ {
+ setobj->numberOfRecordsReturned = 0;
+ printf ("They are diagnostic!!!\n");
+ /*
+ char buf[16];
+ sprintf (buf, "%d", *zrs->u.nonSurrogateDiagnostic->condition);
+ Tcl_AppendResult (interp, "Diagnostic message: ", buf,
+ " : ",
+ zrs->u.nonSurrogateDiagnostic->addinfo, NULL);
+ return TCL_ERROR;
+ */
+ return;
+ }
+ else
+ {
+ int offset;
+ IRRecordList *rl;
+
+ setobj->numberOfRecordsReturned =
+ zrs->u.databaseOrSurDiagnostics->num_records;
+ printf ("Got %d records\n", setobj->numberOfRecordsReturned);
+ for (offset = 0; offset<setobj->numberOfRecordsReturned; offset++)
+ {
+ int no = setobj->start + offset;
+
+ for (rl = setobj->record_list; rl; rl = rl->next)
+ {
+ if (no == rl->no)
+ {
+ if (rl->rec)
+ iso2709_rm (rl->rec);
+ break;
+ }
+ }
+ if (!rl)
+ {
+ rl = malloc (sizeof(*rl));
+ assert (rl);
+ rl->next = setobj->record_list;
+ rl->no = no;
+ rl->status = 0;
+ setobj->record_list = rl;
+ }
+ if (zrs->u.databaseOrSurDiagnostics->records[offset]->which ==
+ Z_NamePlusRecord_surrogateDiagnostic)
+ {
+ rl->status = -1;
+ rl->rec = NULL;
+ }
+ else
+ {
+ Z_DatabaseRecord *zr;
+ Odr_external *oe;
+
+ rl->status = 0;
+ zr = zrs->u.databaseOrSurDiagnostics->records[offset]
+ ->u.databaseRecord;
+ oe = (Odr_external*) zr;
+ if (oe->which == ODR_EXTERNAL_octet
+ && zr->u.octet_aligned->len)
+ {
+ const char *buf = (char*) zr->u.octet_aligned->buf;
+ rl->rec = iso2709_cvt (buf);
+ }
+ }
+ }
+ }
+ }