X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=zlayer%2Fzaccess.c;h=3cbc5ca590a99a886680f17cc762d8a47b56bb04;hb=c3d25c24fb405af98c6879fa7f5f619ccc895151;hp=5cdb65b270d6f08506552f427d728dd051225367;hpb=45c72ce7d717adc48baa340a6bc5050fd22cdd09;p=egate.git diff --git a/zlayer/zaccess.c b/zlayer/zaccess.c index 5cdb65b..3cbc5ca 100644 --- a/zlayer/zaccess.c +++ b/zlayer/zaccess.c @@ -1,8 +1,25 @@ /* * Europagate, 1995 * + * Z39.50 API for the Email gateway + * * $Log: zaccess.c,v $ - * Revision 1.8 1995/02/17 14:48:41 quinn + * Revision 1.14 1995/02/23 08:32:26 adam + * Changed header. + * + * Revision 1.12 1995/02/20 20:35:37 quinn + * Pull present status from presresp. + * + * Revision 1.11 1995/02/20 18:58:05 quinn + * Added hack for record in ANY + * + * Revision 1.10 1995/02/20 18:19:30 quinn + * More relaxed about record types. + * + * Revision 1.9 1995/02/17 15:17:51 quinn + * Bug fix + * + * Revision 1.8 1995/02/17 14:48:41 quinn * 'nother bug in present * * Revision 1.7 1995/02/17 14:42:21 quinn @@ -339,13 +356,19 @@ void get_responserecords(zass_record ***p, DATA_DIR *rec) else { gw_log(GW_LOG_WARN, ZASS_TYPE, "ZLAYER only knows USMARC at this point."); - return; + gw_log(GW_LOG_WARN, ZASS_TYPE, "Type was '%d'", (**p)->which); } align = External_GetEncodingAligned(ext); if (!align) { - gw_log(GW_LOG_WARN, ZASS_TYPE, "AAAARRRGH!! Enough of these log-messages!!!"); - return; + gw_log(GW_LOG_WARN, ZASS_TYPE, "Record wasn't octet-aligned"); + align = External_GetEncodingSingle(ext); + if (!align) + { + gw_log(GW_LOG_WARN, ZASS_TYPE, "Record wasn't ANY"); + return; + } + align = align->ptr.child; } if (!((**p)->record = malloc(align->count + 1))) { @@ -384,9 +407,9 @@ const struct zass_presentent *zass_present(ZASS a, char *resname, int start, } do { - gw_log(ZASS_DEBUG, ZASS_TYPE, "Fetching %d records from # %d", num, + gw_log(ZASS_DEBUG, ZASS_TYPE, "Fetching %d records from # %d", num - r.num, start); - pdu = PresentRequest_CreateInitAllASCII(0, resname, start, num, "F", + pdu = PresentRequest_CreateInitAllASCII(0, resname, start, num - r.num, "F", USMARC_OID); if (!pdu) { @@ -421,6 +444,7 @@ const struct zass_presentent *zass_present(ZASS a, char *resname, int start, } gw_log(ZASS_DEBUG, ZASS_TYPE, "Got presentresponse"); r.num += PresentResponse_GetNumberOfRecordsReturned(pdu); + r.presentstatus = PresentResponse_GetPresentStatus(pdu); if (r.num == 0) { gw_log(GW_LOG_WARN, ZASS_TYPE, "Got 0 records from target."); @@ -428,7 +452,6 @@ const struct zass_presentent *zass_present(ZASS a, char *resname, int start, } r.nextpos = PresentResponse_GetNextResultSetPosition(pdu); start = r.nextpos; - num -= r.num; switch(PresentResponse_GetRecordType(pdu)) { case RESPONSERECORDS_TAG: @@ -442,7 +465,7 @@ const struct zass_presentent *zass_present(ZASS a, char *resname, int start, } PresentResponse_Destroy(pdu); } - while (num); + while (num - r.num); *rec = 0; return &r;